Skip to content

Commit

Permalink
Merge pull request #2604 from safe-global/gh-2568/change-whatsnew-layout
Browse files Browse the repository at this point in the history
Gh 2568/change whatsnew layout
  • Loading branch information
Dmitry Bespalov authored Aug 30, 2022
2 parents 7756c99 + 4cfafbf commit dd50445
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 68 deletions.
34 changes: 17 additions & 17 deletions Multisig.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@
0A7AEAF62463189400014184 /* CenteredAddressWithLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7AEAF52463189400014184 /* CenteredAddressWithLink.swift */; };
0A7AEAF82463190100014184 /* LoadableENSNameText.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7AEAF72463190100014184 /* LoadableENSNameText.swift */; };
0A7B3518288071EB00EC04EC /* TestCoreDataStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5556A03B24489F5D003EC861 /* TestCoreDataStack.swift */; };
0A7FBE2528BE684100B5FFCF /* WhatsNewKit in Frameworks */ = {isa = PBXBuildFile; productRef = 0A7FBE2428BE684100B5FFCF /* WhatsNewKit */; };
0A802B8124E413450001790F /* HTTPClientError.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A802B8024E413450001790F /* HTTPClientError.swift */; };
0A802B9024E581A50001790F /* SafeClientGatewayServiceIntegrationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A802B8F24E581A50001790F /* SafeClientGatewayServiceIntegrationTests.swift */; };
0A802B9224E5843B0001790F /* PagedRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A802B9124E5843B0001790F /* PagedRequest.swift */; };
Expand Down Expand Up @@ -820,7 +821,6 @@
931AB80628808F3600264AAA /* TransactionPreviewRequest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 931AB80528808F3600264AAA /* TransactionPreviewRequest.swift */; };
935DCA4C27BD14C600F09EE4 /* WebConnectionDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 935DCA4B27BD14C500F09EE4 /* WebConnectionDetailsViewController.swift */; };
9388B98227C8DDE400AAB7F5 /* SafeDeploymentNotificationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9388B98127C8DDE400AAB7F5 /* SafeDeploymentNotificationController.swift */; };
93D9013E27727E2500624B29 /* WhatsNewKit in Frameworks */ = {isa = PBXBuildFile; productRef = 93D9013D27727E2500624B29 /* WhatsNewKit */; };
93EE3F702760EC7E00111F17 /* IntercomConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93EE3F6F2760EC7E00111F17 /* IntercomConfig.swift */; };
93EE3F752760F49800111F17 /* Intercom in Frameworks */ = {isa = PBXBuildFile; productRef = 93EE3F742760F49800111F17 /* Intercom */; };
93EF2FA327C546330077BE95 /* InstructionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93EF2FA127C546330077BE95 /* InstructionsViewController.swift */; };
Expand Down Expand Up @@ -1822,6 +1822,7 @@
55D3FF90260B2B21008ABD2B /* TrustKit in Frameworks */,
55D3FE8C260A0F88008ABD2B /* SwiftCryptoTokenFormatter in Frameworks */,
5591CEEE260C725C0067DFDF /* BlockiesSwift in Frameworks */,
0A7FBE2528BE684100B5FFCF /* WhatsNewKit in Frameworks */,
0A3DAD9426270F4D00743E38 /* unistring.xcframework in Frameworks */,
0A259AB7287D85B3006770E7 /* Web3 in Frameworks */,
043350AF2808628E003725E2 /* Lottie in Frameworks */,
Expand All @@ -1832,7 +1833,6 @@
0A5B87E2278633FF000B66EA /* Ethereum in Frameworks */,
55888DFF260C4F6200940347 /* SwiftAccessPolicy in Frameworks */,
0463F5C326296924009C04FA /* FirebaseCrashlytics in Frameworks */,
93D9013E27727E2500624B29 /* WhatsNewKit in Frameworks */,
0A29B5622666808A0060F06A /* FirebaseAnalyticsWithoutAdIdSupport in Frameworks */,
0463F5C526296924009C04FA /* FirebaseMessaging in Frameworks */,
);
Expand Down Expand Up @@ -4176,13 +4176,13 @@
55DA0662269C9411006C9AA5 /* Version */,
93EE3F742760F49800111F17 /* Intercom */,
D80B5A12276B5FAD00D6E024 /* SkeletonView */,
93D9013D27727E2500624B29 /* WhatsNewKit */,
0A5B87E1278633FF000B66EA /* Ethereum */,
0A3E980A2806FAD300E90EEC /* Algorithms */,
043350AE2808628E003725E2 /* Lottie */,
0A0C094B287D7D48000CEB4F /* WalletConnectSwift */,
0A259AB4287D83F9006770E7 /* UnstoppableDomainsResolution */,
0A259AB6287D85B3006770E7 /* Web3 */,
0A7FBE2428BE684100B5FFCF /* WhatsNewKit */,
);
productName = Multisig;
productReference = 0A93DD532445CC8A00688050 /* Multisig_PROD.app */;
Expand Down Expand Up @@ -4295,12 +4295,12 @@
55DA0661269C9411006C9AA5 /* XCRemoteSwiftPackageReference "Version" */,
93EE3F732760F49700111F17 /* XCRemoteSwiftPackageReference "intercom-ios" */,
D80B5A11276B5FAD00D6E024 /* XCRemoteSwiftPackageReference "SkeletonView" */,
93D9013C27727E2400624B29 /* XCRemoteSwiftPackageReference "WhatsNewKit" */,
0A3E98092806FAD300E90EEC /* XCRemoteSwiftPackageReference "swift-algorithms" */,
043350AD2808628E003725E2 /* XCRemoteSwiftPackageReference "lottie-ios" */,
0A0C094A287D7D48000CEB4F /* XCRemoteSwiftPackageReference "WalletConnectSwift" */,
0A259AB2287D83D5006770E7 /* XCRemoteSwiftPackageReference "Web3.swift" */,
0A259AB3287D83F9006770E7 /* XCRemoteSwiftPackageReference "resolution-swift" */,
0A7FBE2328BE682C00B5FFCF /* XCRemoteSwiftPackageReference "WhatsNewKit" */,
);
productRefGroup = 0A93DD542445CC8A00688050 /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -6618,6 +6618,14 @@
minimumVersion = 1.9.0;
};
};
0A7FBE2328BE682C00B5FFCF /* XCRemoteSwiftPackageReference "WhatsNewKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/5afe/WhatsNewKit";
requirement = {
branch = "add-image-alignment";
kind = branch;
};
};
55888DFD260C4F6200940347 /* XCRemoteSwiftPackageReference "SwiftAccessPolicy" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/gnosis/SwiftAccessPolicy.git";
Expand Down Expand Up @@ -6666,14 +6674,6 @@
minimumVersion = 2.0.1;
};
};
93D9013C27727E2400624B29 /* XCRemoteSwiftPackageReference "WhatsNewKit" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/SvenTiigi/WhatsNewKit.git";
requirement = {
kind = upToNextMajorVersion;
minimumVersion = 1.0.0;
};
};
93EE3F732760F49700111F17 /* XCRemoteSwiftPackageReference "intercom-ios" */ = {
isa = XCRemoteSwiftPackageReference;
repositoryURL = "https://github.com/intercom/intercom-ios.git";
Expand Down Expand Up @@ -6752,6 +6752,11 @@
package = 0A61E83A2670DE68009D68A4 /* XCRemoteSwiftPackageReference "swift-snapshot-testing" */;
productName = SnapshotTesting;
};
0A7FBE2428BE684100B5FFCF /* WhatsNewKit */ = {
isa = XCSwiftPackageProductDependency;
package = 0A7FBE2328BE682C00B5FFCF /* XCRemoteSwiftPackageReference "WhatsNewKit" */;
productName = WhatsNewKit;
};
0AC63625287EB85D00286F22 /* Web3 */ = {
isa = XCSwiftPackageProductDependency;
package = 0A259AB2287D83D5006770E7 /* XCRemoteSwiftPackageReference "Web3.swift" */;
Expand Down Expand Up @@ -6787,11 +6792,6 @@
package = 55DA0661269C9411006C9AA5 /* XCRemoteSwiftPackageReference "Version" */;
productName = Version;
};
93D9013D27727E2500624B29 /* WhatsNewKit */ = {
isa = XCSwiftPackageProductDependency;
package = 93D9013C27727E2400624B29 /* XCRemoteSwiftPackageReference "WhatsNewKit" */;
productName = WhatsNewKit;
};
93EE3F742760F49800111F17 /* Intercom */ = {
isa = XCSwiftPackageProductDependency;
package = 93EE3F732760F49700111F17 /* XCRemoteSwiftPackageReference "intercom-ios" */;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,11 +291,11 @@
},
{
"package": "WhatsNewKit",
"repositoryURL": "https://github.com/SvenTiigi/WhatsNewKit.git",
"repositoryURL": "https://github.com/5afe/WhatsNewKit",
"state": {
"branch": null,
"revision": "92a9d6f5f6754aba0df972514fd7686f1de03bcc",
"version": "1.3.7"
"branch": "add-image-alignment",
"revision": "17f1eaa553394f8eeaff90d1081d00f9a3f2de86",
"version": null
}
}
]
Expand Down
14 changes: 3 additions & 11 deletions Multisig.xcodeproj/xcshareddata/xcschemes/All Tests.xcscheme
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1250"
version = "1.3">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
Expand Down Expand Up @@ -71,7 +71,8 @@
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0A93DD522445CC8A00688050"
Expand All @@ -80,15 +81,6 @@
ReferencedContainer = "container:Multisig.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "0A93DD522445CC8A00688050"
BuildableName = "Multisig_PROD.app"
BlueprintName = "Multisig"
ReferencedContainer = "container:Multisig.xcodeproj">
</BuildableReference>
</MacroExpansion>
<LocationScenarioReference
identifier = "com.apple.dt.IDEFoundation.CurrentLocationScenarioIdentifier"
referenceType = "1">
Expand Down
4 changes: 3 additions & 1 deletion Multisig/UI/App/MainTabBarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ class MainTabBarViewController: UITabBarController {

onFirstAppear(self)

WhatsNewHandler().whatsNewViewController?.present(on: self)
if let whatsNewVC = WhatsNewHandler().whatsNewViewController {
present(whatsNewVC, animated: true)
}

WebConnectionController.shared.reconnect()

Expand Down
80 changes: 45 additions & 35 deletions Multisig/UI/App/WhatsNewHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,63 @@

import UIKit
import WhatsNewKit
import SwiftUI

class WhatsNewHandler {
private let whatsNew = WhatsNew(
// Show the WhatsNew screen only once for users of this version
version: WhatsNew.Version(major: 3, minor: 16, patch: 0),
title: "What's new",
items: [
WhatsNew.Item(
title: "We have changed!",
subtitle: "Gnosis Safe rebranded to Safe. Following a successful spin-off vote from Gnosis in GIP-29, we are rebranding to Safe. Now and over the coming time, you will see a new look and a better visual experience to your ever secure Gnosis Safe that you love.",
image: UIImage(named: "ico-whats-new-rebrand")
)
]
)

var whatsNewViewController: WhatsNewViewController?

init() {
let whatsNews = [whatsNew]
var configuration = WhatsNewViewController.Configuration()
let title: WhatsNew.Title
let featureText: WhatsNew.Text

configuration.backgroundColor = .backgroundSecondary
if #available(iOS 15, *) {
var titleString = AttributedString("What's new")
titleString.font = .systemFont(ofSize: 26, weight: .regular)
titleString.foregroundColor = .labelPrimary
title = .init(text: WhatsNew.Text(titleString))

configuration.titleView.titleColor = .labelPrimary
configuration.titleView.titleFont = .systemFont(ofSize: 26, weight: .regular)

configuration.itemsView.titleFont = .systemFont(ofSize: 16, weight: .bold)
configuration.itemsView.titleColor = .labelPrimary
configuration.itemsView.subtitleColor = .labelSecondary
var featureString = AttributedString("Gnosis Safe has rebranded to Safe following a successful spin-off from the Gnosis DAO.\n\nNow and over the coming versions, you will see a new look and a better user experience for your ever secure Gnosis Safe.")
featureString.foregroundColor = .labelSecondary

configuration.detailButton?.titleColor = .primary
configuration.completionButton.backgroundColor = .primary
configuration.completionButton.title = "Let's go"
featureText = .init(featureString)

} else {
title = "What's new"
featureText = "Gnosis Safe has rebranded to Safe following a successful spin-off from the Gnosis DAO.\n\nNow and over the coming versions, you will see a new look and a better user experience for your ever secure Gnosis Safe."
}

configuration.itemsView.autoTintImage = false

let keyValueVersionStore = KeyValueWhatsNewVersionStore(
keyValueable: UserDefaults.standard
let whatsNew = WhatsNew(
version: "3.16.0",
title: title,
features: [
WhatsNew.Feature(
image: WhatsNew.Feature.Image(name: "ico-whats-new-rebrand", bundle: .main, renderingMode: .original, foregroundColor: nil),
title: "Meet the new Safe!",
subtitle: featureText
)
],
primaryAction: WhatsNew.PrimaryAction(
title: "Let's go",
backgroundColor: .primary,
foregroundColor: .backgroundPrimary,
hapticFeedback: .notification(.success),
onDismiss: nil
),
secondaryAction: nil
)

let whatsNewForCurrentVersion = whatsNews.get(byVersion: .current())
if let whatsNewForCurrentVersion = whatsNewForCurrentVersion {
whatsNewViewController = WhatsNewViewController(
whatsNew: whatsNewForCurrentVersion,
configuration: configuration,
versionStore: keyValueVersionStore // use InMemoryWhatsNewVersionStore() for debugging
)
}
// for debugging, use the In-memory store version
let versionStore: WhatsNewVersionStore = UserDefaultsWhatsNewVersionStore()
// let versionStore: WhatsNewVersionStore = InMemoryWhatsNewVersionStore()

let layout = WhatsNew.Layout(featureImageWidth: 60, featureHorizontalAlignment: .top)

whatsNewViewController = WhatsNewViewController(
whatsNew: whatsNew,
versionStore: versionStore,
layout: layout
)
}
}

0 comments on commit dd50445

Please sign in to comment.