Skip to content

Commit

Permalink
User interface readjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
ctkqiang committed Feb 17, 2023
1 parent 7e4a2bb commit 9a467f0
Show file tree
Hide file tree
Showing 10 changed files with 439 additions and 393 deletions.
4 changes: 4 additions & 0 deletions Cryato.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
1A510D232994488B00F65B0D /* .gitignore in Resources */ = {isa = PBXBuildFile; fileRef = 1A510D222994488B00F65B0D /* .gitignore */; };
1A510D252994BBD500F65B0D /* SharedPreferences.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A510D242994BBD500F65B0D /* SharedPreferences.swift */; };
1A510D282994C07000F65B0D /* SharedPreferenceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A510D272994C07000F65B0D /* SharedPreferenceType.swift */; };
1A736E34299FB76F001E6921 /* AddRecordsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A736E33299FB76F001E6921 /* AddRecordsView.swift */; };
1A7B04EC2993D547008D46C3 /* ScannerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A7B04EB2993D547008D46C3 /* ScannerView.swift */; };
1A7B04EE2993E6FB008D46C3 /* RecordsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A7B04ED2993E6FB008D46C3 /* RecordsView.swift */; };
1A7BC4DF299786A70046D622 /* BybitEncryption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1A7BC4DE299786A70046D622 /* BybitEncryption.swift */; };
Expand Down Expand Up @@ -128,6 +129,7 @@
1A510D242994BBD500F65B0D /* SharedPreferences.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedPreferences.swift; sourceTree = "<group>"; };
1A510D272994C07000F65B0D /* SharedPreferenceType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedPreferenceType.swift; sourceTree = "<group>"; };
1A510D292994F7B300F65B0D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
1A736E33299FB76F001E6921 /* AddRecordsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddRecordsView.swift; sourceTree = "<group>"; };
1A7B04EB2993D547008D46C3 /* ScannerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScannerView.swift; sourceTree = "<group>"; };
1A7B04ED2993E6FB008D46C3 /* RecordsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecordsView.swift; sourceTree = "<group>"; };
1A7BC4DE299786A70046D622 /* BybitEncryption.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BybitEncryption.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -383,6 +385,7 @@
1A93904C299533F1004AB56D /* AssetsView.swift */,
1A0242CE299B832F005C40BE /* ScamView.swift */,
1A0242EC299CC764005C40BE /* AddScamList.swift */,
1A736E33299FB76F001E6921 /* AddRecordsView.swift */,
);
path = Views;
sourceTree = "<group>";
Expand Down Expand Up @@ -579,6 +582,7 @@
1A1B55D3298989BF00C2C773 /* Calculator.swift in Sources */,
1A7B04EC2993D547008D46C3 /* ScannerView.swift in Sources */,
1AF58EBD2998FF04003BD1DA /* Cryptocurrencies.swift in Sources */,
1A736E34299FB76F001E6921 /* AddRecordsView.swift in Sources */,
1A1B55D629899CD800C2C773 /* Double.swift in Sources */,
1A0242DA299BA278005C40BE /* InAppWeb.swift in Sources */,
1A7BC4DF299786A70046D622 /* BybitEncryption.swift in Sources */,
Expand Down
20 changes: 20 additions & 0 deletions Cryato/Views/AddRecordsView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//
// AddRecordsView.swift
// Cryato
//
// Created by John Melody Me on 17/02/2023.
//

import SwiftUI

struct AddRecordsView: View {
var body: some View {
Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/)
}
}

struct AddRecordsView_Previews: PreviewProvider {
static var previews: some View {
AddRecordsView()
}
}
151 changes: 79 additions & 72 deletions Cryato/Views/AddScamList.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,85 +34,92 @@ struct AddScamList: View {
private var TechniquePlaceholder :String = "What's the technique the scammer used?"

public var body: some View {
VStack(alignment: .leading) {
Section(header: Text("")) {
TextField(self.WalletIdPlaceholder, text: self.$walletID)
.textFieldStyle(.roundedBorder)
.font(Font.system(size: 12))
.padding(5)

TextField(self.PaymentMethodPlaceholder, text: self.$paymentMethod)
.textFieldStyle(.roundedBorder)
.font(Font.system(size: 12))
.padding(5)

TextField(self.CurrencyPlaceholder, text: self.$currency)
.textFieldStyle(.roundedBorder)
.font(Font.system(size: 12))
.padding(5)

TextField(self.PlatformPlaceholder, text: self.$platform)
.textFieldStyle(.roundedBorder)
.font(Font.system(size: 12))
.padding(5)

TextField(self.NamePlaceholder, text: self.$name)
.textFieldStyle(.roundedBorder)
.font(Font.system(size: 12))
.padding(5)

TextField(self.TechniquePlaceholder, text: self.$technique)
.textFieldStyle(.roundedBorder)
.font(Font.system(size: 12))
.padding(5)

Button {
if self.currency.isEmpty ||
self.platform.isEmpty ||
self.name.isEmpty ||
self.technique.isEmpty {
self.showAlert = true
} else {
NavigationView {
Form {
VStack(alignment: .leading) {
Section(header: Text("")) {
TextField(self.WalletIdPlaceholder, text: self.$walletID)
.textFieldStyle(.roundedBorder)
.font(Font.system(size: 12))
.padding(5)

let data :[String: String] = [
"Name" : self.name,
"WalletID" : self.walletID,
"PaymentMethod" : self.paymentMethod,
"Currency" : self.currency,
"Platform" : self.platform,
"Techniques" : self.technique
]
TextField(self.PaymentMethodPlaceholder, text: self.$paymentMethod)
.textFieldStyle(.roundedBorder)
.font(Font.system(size: 12))
.padding(5)

if let discordChannel = Bundle.main.infoDictionary?["DISCORD_WEBHOOK"] as? String {
try! LogToDiscord(
appName: "Cryato APP",
webhookUrl: "https://\(discordChannel)"
).send(message: "\(data)", level: Level.Debug, delay: 0x1)
TextField(self.CurrencyPlaceholder, text: self.$currency)
.textFieldStyle(.roundedBorder)
.font(Font.system(size: 12))
.padding(5)

TextField(self.PlatformPlaceholder, text: self.$platform)
.textFieldStyle(.roundedBorder)
.font(Font.system(size: 12))
.padding(5)

TextField(self.NamePlaceholder, text: self.$name)
.textFieldStyle(.roundedBorder)
.font(Font.system(size: 12))
.padding(5)

TextField(self.TechniquePlaceholder, text: self.$technique)
.textFieldStyle(.roundedBorder)
.font(Font.system(size: 12))
.padding(5)

NavigationLink {
ScamView()
} label: {
Button {
if self.currency.isEmpty ||
self.platform.isEmpty ||
self.name.isEmpty ||
self.technique.isEmpty {
self.showAlert = true
} else {

let data :[String: String] = [
"Name" : self.name,
"WalletID" : self.walletID,
"PaymentMethod" : self.paymentMethod,
"Currency" : self.currency,
"Platform" : self.platform,
"Techniques" : self.technique
]

if let discordChannel = Bundle.main.infoDictionary?["DISCORD_WEBHOOK"] as? String {
try! LogToDiscord(
appName: "Cryato APP",
webhookUrl: "https://\(discordChannel)"
).send(message: "\(data)", level: Level.Debug, delay: 0x1)
}
}

hideKeyboard()
} label: {
Text("ADD TO DATABASE")
.frame(minWidth: 0, maxWidth: .infinity)
}
}
}

hideKeyboard()
} label: {
Text("ADD TO DATABASE")
.frame(minWidth: 0, maxWidth: .infinity)
.foregroundColor(.white)
.buttonStyle(.borderedProminent)
.buttonBorderShape(.roundedRectangle)
.tint(.blue)
.frame(height: 60)
.controlSize(.large)
.padding()
}
}
.frame(minWidth: 0, maxWidth: .infinity)
.buttonStyle(.borderedProminent)
.buttonBorderShape(.roundedRectangle)
.tint(.blue)
.frame(height: 60)
.controlSize(.large)
.padding()
.toast(isPresenting: self.$showAlert, alert: {
AlertToast(
type: .error(.red),
title: "Warning",
subTitle: "Please fill in all the required field!\n(except for \"walletid\")"
)
})
}
}
.toast(isPresenting: self.$showAlert, alert: {
AlertToast(
type: .error(.red),
title: "Warning",
subTitle: "Please fill in all the required field!\n(except for \"walletid\")"
)
})
}
}

Expand Down
15 changes: 13 additions & 2 deletions Cryato/Views/AssetsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
import SwiftUI

struct AssetsView: View {
var body: some View {
@Environment(\.colorScheme) private var colorScheme

public var body: some View {
NavigationView {
Form {
VStack {
Expand All @@ -18,13 +20,22 @@ struct AssetsView: View {
.navigationBarTitle("Assets")
.refreshable {
// @TODO
}.toolbar {
ToolbarItem(placement: .navigationBarTrailing) {
NavigationLink {
/** Navigate to app preference page */
PreferenceView()
} label: {
Image(systemName: "gearshape").foregroundColor(self.colorScheme == .dark ? Color.white : Color.black)
}
}
}
}
}
}

struct AssetsView_Previews: PreviewProvider {
static var previews: some View {
public static var previews: some View {
AssetsView()
}
}
Loading

0 comments on commit 9a467f0

Please sign in to comment.