Skip to content

Commit

Permalink
Merge pull request #1230 from novasamatech/develop
Browse files Browse the repository at this point in the history
8.7.0. SwipeGov implementation
  • Loading branch information
ERussel authored Oct 9, 2024
2 parents e2c176c + 8a36667 commit 368c77c
Show file tree
Hide file tree
Showing 215 changed files with 13,267 additions and 1,378 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/deploy_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ jobs:
MOONBEAM_API_KEY: ${{ secrets.MOONBEAM_API_KEY }}
MOONBEAM_TEST_API_KEY: ${{ secrets.MOONBEAM_TEST_API_KEY }}
WC_PROJECT_ID: ${{ secrets.WC_PROJECT_ID }}
POLKASSEMBLY_SUMMARY_API_KEY: ${{ secrets.POLKASSEMBLY_SUMMARY_API_KEY }}
run: xcodebuild archive -archivePath ./AdHoc.xcarchive -scheme novawallet -workspace novawallet.xcworkspace -configuration ${{ github.event.inputs.config }}

- name: Export Staging archive
Expand All @@ -126,7 +127,7 @@ jobs:
run: xcodebuild -exportArchive -archivePath ./AdHoc.xcarchive -exportPath ./export -exportOptionsPlist ./novawallet/exportOptionsAdHoc.plist

- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: novawallet.ipa
path: export
Expand All @@ -139,7 +140,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: novawallet.ipa
path: export
Expand All @@ -162,4 +163,4 @@ jobs:
serviceCredentialsFileContent: ${{ secrets.CREDENTIAL_FILE_CONTENT }}
groups: ${{ github.event.inputs.userGroup }}
file: export/novawallet.ipa
releaseNotes: ${{ github.event.head_commit.message }}
releaseNotes: ${{ github.event.head_commit.message }}
5 changes: 5 additions & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Build and Test on PR
on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
build:
name: Build and Test default scheme using any available iPhone simulator
Expand Down Expand Up @@ -61,6 +65,7 @@ jobs:
MOONBEAM_API_KEY: ${{ secrets.MOONBEAM_API_KEY }}
MOONBEAM_TEST_API_KEY: ${{ secrets.MOONBEAM_TEST_API_KEY }}
WC_PROJECT_ID: ${{ secrets.WC_PROJECT_ID }}
POLKASSEMBLY_SUMMARY_API_KEY: ${{ secrets.POLKASSEMBLY_SUMMARY_API_KEY }}
run: |
# xcrun xctrace returns via stderr, not the expected stdout (see https://developer.apple.com/forums/thread/663959)
# device=`xcrun xctrace list devices 2>&1 | grep -oE 'iPhone.*?[^\(]+' | head -1 | awk '{$1=$1;print}'`
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/push_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ jobs:
MOONBEAM_API_KEY: ${{ secrets.MOONBEAM_API_KEY }}
MOONBEAM_TEST_API_KEY: ${{ secrets.MOONBEAM_TEST_API_KEY }}
WC_PROJECT_ID: ${{ secrets.WC_PROJECT_ID }}
POLKASSEMBLY_SUMMARY_API_KEY: ${{ secrets.POLKASSEMBLY_SUMMARY_API_KEY }}
run: xcodebuild archive -archivePath ./AdHoc.xcarchive -scheme novawallet -workspace novawallet.xcworkspace -configuration Dev

- name: Export archive
run: xcodebuild -exportArchive -archivePath ./AdHoc.xcarchive -exportPath ./export -exportOptionsPlist ./novawallet/exportOptionsAdHoc.plist

- name: Upload artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: novawallet.ipa
path: export
Expand All @@ -110,7 +111,7 @@ jobs:

steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
- uses: actions/download-artifact@v4
with:
name: novawallet.ipa
path: export
Expand Down
1,073 changes: 852 additions & 221 deletions novawallet.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"colors" : [
{
"color" : {
"color-space" : "srgb",
"components" : {
"alpha" : "0.640",
"blue" : "0xFF",
"green" : "0xFF",
"red" : "0xFF"
}
},
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
12 changes: 12 additions & 0 deletions novawallet/Assets.xcassets/gov/iconSwipeGov.imageset/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "Tinder Gov.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "imageSiriTinderGov.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Binary file not shown.
4 changes: 4 additions & 0 deletions novawallet/CIKeys.stencil
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@ enum ConnectionApiKeys {
enum WalletConnectCISecrets {
static var projectId: String = "{{ argument.wcProjectId }}"
}

enum PolkassemblyApiKeys {
static var summaryApi: String = "{{ argument.polkassemblySummaryApiKey }}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ extension Locale {
var rLanguages: [String]? {
[identifier]
}

var languageCodeOrEn: String {
languageCode ?? "en"
}
}

extension Localizable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,4 +418,44 @@ extension NSPredicate {

return NSCompoundPredicate(orPredicateWithSubpredicates: predicates)
}

static func votingBasketItems(
for chainId: ChainModel.Id,
metaId: String
) -> NSPredicate {
let chainPredicate = NSPredicate(
format: "%K == %@",
#keyPath(CDVotingBasketItem.chainId),
chainId
)
let metaAccountPredicate = NSPredicate(
format: "%K == %@",
#keyPath(CDVotingBasketItem.metaId),
metaId
)

return NSCompoundPredicate(
andPredicateWithSubpredicates: [chainPredicate, metaAccountPredicate]
)
}

static func votingPower(
for chainId: ChainModel.Id,
metaId: String
) -> NSPredicate {
let chainPredicate = NSPredicate(
format: "%K == %@",
#keyPath(CDVotingPower.chainId),
chainId
)
let metaAccountPredicate = NSPredicate(
format: "%K == %@",
#keyPath(CDVotingPower.metaId),
metaId
)

return NSCompoundPredicate(
andPredicateWithSubpredicates: [chainPredicate, metaAccountPredicate]
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ extension String {
static var returnKey: String { "\n" }
static var readMore: String { "..." }
static var empty: String = ""
static var quote: String = "\""

func firstLetterCapitalized() -> String {
prefix(1).capitalized + dropFirst()
Expand Down
1 change: 1 addition & 0 deletions novawallet/Common/Extension/Foundation/String+Split.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ extension String {
case space = " "
case comma = ","
case dot = "."
case dash = "-"
}

enum CompoundSeparator: String {
Expand Down
17 changes: 17 additions & 0 deletions novawallet/Common/Extension/Foundation/String+Trimming.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import Foundation

extension String {
func trimmingQuotes() -> String {
trimmingPattern(Self.quote)
}

func trimmingPattern(_ pattern: String) -> String {
guard hasPrefix(pattern), hasSuffix(pattern), count >= 2 * pattern.count else {
return self
}

let temp = prefix(count - pattern.count)

return String(temp.suffix(temp.count - pattern.count))
}
}
10 changes: 10 additions & 0 deletions novawallet/Common/Extension/UIKit/Style/RoundedView+Style.swift
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,16 @@ extension RoundedView.Style {
fillColor: .clear,
highlightedFillColor: .clear
)

static let divider = RoundedView.Style(
shadowOpacity: 0,
strokeWidth: 0,
strokeColor: R.color.colorDivider(),
highlightedStrokeColor: .clear,
fillColor: .clear,
highlightedFillColor: .clear,
rounding: .init(radius: 0, corners: .allCorners)
)
}

extension RoundedView.Style {
Expand Down
11 changes: 11 additions & 0 deletions novawallet/Common/Extension/UIKit/UIEdgeInsets+Init.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import UIKit

extension UIEdgeInsets {
init(verticalInset: CGFloat = .zero, horizontalInset: CGFloat = .zero) {
self.init(top: verticalInset, left: horizontalInset, bottom: verticalInset, right: horizontalInset)
}

init(inset: CGFloat) {
self.init(top: inset, left: inset, bottom: inset, right: inset)
}
}
22 changes: 22 additions & 0 deletions novawallet/Common/Helpers/GradientModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,26 @@ extension GradientModel {
locations: [0.0, 1.0]
)
}

static var swipeGovBackgroundGradient: GradientModel {
GradientModel(
startPoint: .init(x: 0.5, y: 0),
endPoint: .init(x: 0.5, y: 1),
colors: [
.init(
red: 83.0 / 255.0,
green: 96.0 / 255.0,
blue: 161.0 / 255.0,
alpha: 1.0
),
.init(
red: 8.0 / 255.0,
green: 9.0 / 255.0,
blue: 14.0 / 255.0,
alpha: 1.0
)
],
locations: [0.0, 0.25, 0.35, 1.0]
)
}
}
3 changes: 3 additions & 0 deletions novawallet/Common/Migration/UserStorageVersion.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ enum UserStorageVersion: String, CaseIterable {
case version11 = "MultiassetUserDataModel10"
case version12 = "MultiassetUserDataModel11"
case version13 = "MultiassetUserDataModel12"
case version14 = "MultiassetUserDataModel13"

static var current: UserStorageVersion {
guard let currentVersion = allCases.last else {
Expand Down Expand Up @@ -50,6 +51,8 @@ enum UserStorageVersion: String, CaseIterable {
case .version12:
return .version13
case .version13:
return .version14
case .version14:
return nil
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ enum LocalChainApiExternalType: String {
case governance
case crowdloans
case governanceDelegations
case referendumSummary
}

struct LocalChainExternalApi: Equatable, Codable, Hashable {
Expand Down Expand Up @@ -62,6 +63,10 @@ struct LocalChainExternalApiSet: Codable, Equatable, Hashable {
getApis(for: .governanceDelegations)
}

func referendumSummary() -> Set<LocalChainExternalApi>? {
getApis(for: .referendumSummary)
}

init(localApis: Set<LocalChainExternalApi>) {
apis = localApis
}
Expand All @@ -73,6 +78,7 @@ struct LocalChainExternalApiSet: Codable, Equatable, Hashable {
.addingApis(from: remoteApi.crowdloans, apiType: .crowdloans)
.addingApis(from: remoteApi.governance, apiType: .governance)
.addingApis(from: remoteApi.goverananceDelegations, apiType: .governanceDelegations)
.addingApis(from: remoteApi.referendumSummary, apiType: .referendumSummary)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ struct RemoteChainExternalApiSet: Equatable, Codable {
case crowdloans
case governance
case goverananceDelegations = "governance-delegations"
case referendumSummary = "referendum-summary"
}

let staking: [RemoteChainExternalApi]?
let history: [RemoteChainExternalApi]?
let crowdloans: [RemoteChainExternalApi]?
let governance: [RemoteChainExternalApi]?
let goverananceDelegations: [RemoteChainExternalApi]?
let referendumSummary: [RemoteChainExternalApi]?
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,11 @@ protocol GovMetadataOperationFactoryProtocol {
parameters: JSON?
) -> BaseOperation<ReferendumMetadataLocal?>
}

protocol OpenGovSummaryOperationFactoryProtocol {
func createSummaryOperation(for referendumId: ReferendumIdLocal) -> BaseOperation<ReferendumSummary?>
}

struct ReferendumSummary: Decodable {
let summary: String
}
Loading

0 comments on commit 368c77c

Please sign in to comment.