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
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
14 deletions
+24
-14
1Weather/InApps/Configuration.storekit
+18
-9
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,7 +60,16 @@
...
@@ -60,7 +60,16 @@
"referenceName" : "Premium Subscription Yearly",
"referenceName" : "Premium Subscription Yearly",
"subscriptionGroupID" : "AC6BEB61",
"subscriptionGroupID" : "AC6BEB61",
"type" : "RecurringSubscription"
"type" : "RecurringSubscription"
},
}
]
},
{
"id" : "4BDB84FF",
"localizations" : [
],
"name" : "Premium Subscription (for Pro)",
"subscriptions" : [
{
{
"adHocOffers" : [
"adHocOffers" : [
...
@@ -68,19 +77,19 @@
...
@@ -68,19 +77,19 @@
"displayPrice" : "1.49",
"displayPrice" : "1.49",
"familyShareable" : false,
"familyShareable" : false,
"groupNumber" : 1,
"groupNumber" : 1,
"internalID" : "
06580AD5
",
"internalID" : "
9E811EB0
",
"introductoryOffer" : null,
"introductoryOffer" : null,
"localizations" : [
"localizations" : [
{
{
"description" : "
Test Description 1W Monthly (Pro)
",
"description" : "",
"displayName" : "1Weather Premium Monthly (Pro)",
"displayName" : "1Weather Premium Monthly (Pro)",
"locale" : "en_US"
"locale" : "en_US"
}
}
],
],
"productID" : "com.onelouder.oneweather.subscription.
premium.forPro
",
"productID" : "com.onelouder.oneweather.subscription.
forPro.premium
",
"recurringSubscriptionPeriod" : "P1M",
"recurringSubscriptionPeriod" : "P1M",
"referenceName" : "Premium Subscription Monthly (for Pro)",
"referenceName" : "Premium Subscription Monthly (for Pro)",
"subscriptionGroupID" : "
AC6BEB61
",
"subscriptionGroupID" : "
4BDB84FF
",
"type" : "RecurringSubscription"
"type" : "RecurringSubscription"
},
},
{
{
...
@@ -90,19 +99,19 @@
...
@@ -90,19 +99,19 @@
"displayPrice" : "6.99",
"displayPrice" : "6.99",
"familyShareable" : false,
"familyShareable" : false,
"groupNumber" : 1,
"groupNumber" : 1,
"internalID" : "
FE3C47E9
",
"internalID" : "
0EE8019B
",
"introductoryOffer" : null,
"introductoryOffer" : null,
"localizations" : [
"localizations" : [
{
{
"description" : "
Test Description 1W Yearly (Pro)
",
"description" : "",
"displayName" : "1Weather Premium Yearly (Pro)",
"displayName" : "1Weather Premium Yearly (Pro)",
"locale" : "en_US"
"locale" : "en_US"
}
}
],
],
"productID" : "com.onelouder.oneweather.subscription.pr
emium.yearly.forPro
",
"productID" : "com.onelouder.oneweather.subscription.pr
o.premium.yearly
",
"recurringSubscriptionPeriod" : "P1Y",
"recurringSubscriptionPeriod" : "P1Y",
"referenceName" : "Premium Subscription Yearly (for Pro)",
"referenceName" : "Premium Subscription Yearly (for Pro)",
"subscriptionGroupID" : "
AC6BEB61
",
"subscriptionGroupID" : "
4BDB84FF
",
"type" : "RecurringSubscription"
"type" : "RecurringSubscription"
}
}
]
]
...
...
1Weather/InApps/StoreManager.swift
View file @
8980fc87
...
@@ -200,13 +200,15 @@ public class StoreManager {
...
@@ -200,13 +200,15 @@ public class StoreManager {
SwiftyStoreKit
.
verifyReceipt
(
using
:
appleValidator
)
{
result
in
SwiftyStoreKit
.
verifyReceipt
(
using
:
appleValidator
)
{
result
in
switch
result
{
switch
result
{
case
.
success
(
let
receipt
):
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
{
switch
purchaseResult
{
case
.
purchased
(
let
expiryDate
,
let
items
):
case
.
purchased
(
let
expiryDate
,
let
items
):
log
.
debug
(
"Verify: purchased subscription (valid until
\(
expiryDate
)
)! Items:
\(
items
)
"
)
log
.
debug
(
"Verify: purchased subscription (valid until
\(
expiryDate
)
)! Items:
\(
items
)
"
)
self
.
hasSubscription
=
true
self
.
hasSubscription
=
true
self
.
everHadSubscription
=
true
self
.
everHadSubscription
=
true
self
.
subscriptionExpirationDate
=
expiryDate
if
let
expDate
=
items
.
first
?
.
subscriptionExpirationDate
{
self
.
subscriptionExpirationDate
=
expDate
}
case
.
expired
(
let
expiryDate
,
let
items
):
case
.
expired
(
let
expiryDate
,
let
items
):
log
.
debug
(
"Subscription expired since
\(
expiryDate
)\n\(
items
)\n
"
)
log
.
debug
(
"Subscription expired since
\(
expiryDate
)\n\(
items
)\n
"
)
self
.
everHadSubscription
=
true
self
.
everHadSubscription
=
true
...
...
OneWeatherCore/OneWeatherCore/ModelObjects/Config/Subscriptions/SubscriptionsListConfig.swift
View file @
8980fc87
...
@@ -15,7 +15,6 @@ public struct SubscriptionsListConfig {
...
@@ -15,7 +15,6 @@ public struct SubscriptionsListConfig {
public
let
yearlyDiscounted
:
SubscriptionConfig
public
let
yearlyDiscounted
:
SubscriptionConfig
public
init
(
subscriptionsEnabled
:
Bool
,
monthly
:
SubscriptionConfig
,
yearly
:
SubscriptionConfig
,
monthlyDiscounted
:
SubscriptionConfig
,
yearlyDiscounted
:
SubscriptionConfig
)
{
public
init
(
subscriptionsEnabled
:
Bool
,
monthly
:
SubscriptionConfig
,
yearly
:
SubscriptionConfig
,
monthlyDiscounted
:
SubscriptionConfig
,
yearlyDiscounted
:
SubscriptionConfig
)
{
self
.
subscriptionsEnabled
=
subscriptionsEnabled
self
.
subscriptionsEnabled
=
subscriptionsEnabled
self
.
monthly
=
monthly
self
.
monthly
=
monthly
self
.
yearly
=
yearly
self
.
yearly
=
yearly
...
@@ -27,8 +26,8 @@ public struct SubscriptionsListConfig {
...
@@ -27,8 +26,8 @@ public struct SubscriptionsListConfig {
self
.
subscriptionsEnabled
=
true
self
.
subscriptionsEnabled
=
true
self
.
monthly
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.premium"
)
self
.
monthly
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.premium"
)
self
.
yearly
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.premium.yearly"
)
self
.
yearly
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.premium.yearly"
)
self
.
monthlyDiscounted
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.
premium.forPro
"
)
self
.
monthlyDiscounted
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.
forPro.premium
"
)
self
.
yearlyDiscounted
=
SubscriptionConfig
(
productId
:
"com.onelouder.oneweather.subscription.pr
emium.yearly.forPro
"
)
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