Skip to content

Commit

Permalink
Feature/in app review system (#148)
Browse files Browse the repository at this point in the history
* add AppReviewView

* add viewmodel

* work in progress

* Add third party mail clients support

* In-App Review system

* add localizations

* Update Assets.swift

* bug fixes

[header] the system bar disappears if a user used the rate us pop-up
[rate_us] the user isn't able to submit a feedback in the landscape mode
[email_feedback] the email template formatting must have a user/device info
[email_agent] iOS agent displays bit a user cannot use it (the icon isn't clickable)

* Update AppReview logic

Added a check to ensure that the rating window is displayed no more than once every 4 months.

Corrected copyright in ThirdPartyMailer

* fixes

move requestReview logic to AppReviewView
replace if/else logic to switch in AppReviewViewModel

* Fix merge conflicts

push SKStoreReviewController logic to extension for iOS 15 compatibility

---------

Co-authored-by: stepanokdev <[email protected]>
  • Loading branch information
IvanStepanok and Stepanokdev authored Nov 17, 2023
1 parent cdcfdb6 commit 0d28f7d
Show file tree
Hide file tree
Showing 43 changed files with 1,229 additions and 7 deletions.
56 changes: 56 additions & 0 deletions Core/Core.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions Core/Core/Assets.xcassets/favorite.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "favorite.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
4 changes: 4 additions & 0 deletions Core/Core/Assets.xcassets/favorite.imageset/favorite.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions Core/Core/Assets.xcassets/mailClients/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"author" : "xcode",
"version" : 1
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "preview.jpg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Mail_(iOS).svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "fastmail.jpeg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "gmail-2015-07-30.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "microsoft-outlook-2015-02-09.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "unnamed.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "spark-mail-smart-email-inbox-2023-01-05.png.jpeg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions Core/Core/Assets.xcassets/mailClients/ymail.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "image-2.png",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions Core/Core/Assets.xcassets/star.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "star.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
3 changes: 3 additions & 0 deletions Core/Core/Assets.xcassets/star.imageset/star.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions Core/Core/Assets.xcassets/star_outline.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"images" : [
{
"filename" : "star_outline.svg",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
},
"properties" : {
"template-rendering-intent" : "template"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 12 additions & 6 deletions Core/Core/Data/CoreStorage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,24 @@ public protocol CoreStorage {
var accessToken: String? {get set}
var refreshToken: String? {get set}
var cookiesDate: String? {get set}
var reviewLastShownVersion: String? {get set}
var lastReviewDate: Date? {get set}
var user: DataLayer.User? {get set}
var userSettings: UserSettings? {get set}
func clear()
}

public struct CoreStorageMock: CoreStorage {
public var accessToken: String? = nil
public var refreshToken: String? = nil
public var cookiesDate: String? = nil
public var user: DataLayer.User? = nil
public var userSettings: UserSettings? = nil
#if DEBUG
public class CoreStorageMock: CoreStorage {
public var accessToken: String?
public var refreshToken: String?
public var cookiesDate: String?
public var reviewLastShownVersion: String?
public var lastReviewDate: Date?
public var user: DataLayer.User?
public var userSettings: UserSettings?
public func clear() {}

public init() {}
}
#endif
20 changes: 20 additions & 0 deletions Core/Core/Extensions/SKStoreReviewControllerExtension.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// SKStoreReviewControllerExtension.swift
// Core
//
// Created by  Stepanok Ivan on 16.11.2023.
//

import Foundation
import StoreKit

extension SKStoreReviewController {
public static func requestReviewInCurrentScene() {
if let scene = UIApplication.shared.connectedScenes
.first(where: { $0.activationState == .foregroundActive }) as? UIWindowScene {
DispatchQueue.main.async {
requestReview(in: scene)
}
}
}
}
Loading

0 comments on commit 0d28f7d

Please sign in to comment.