Skip to content

Commit a179085

Browse files
catreedleprince-0408andrewtavis
authored
Download language list (#578)
* add download language list and download button * add confirmation dialog on clicking download language * Fix translation source language display by setting parentSection before cell configuration * Use saved translation source language in download confirmation * localizing source language * replace {source_language} with actual localize source language in settings * add navigation to translation source language from Download screen * update selection language title and back button label * navigate to download screen on confirming translation source language * remove pop up button from InstallationVC * fix: handling tapping Installation tab bar in Download screen * add DownloadStateManager and handle download in DownloadDataScreen * handle download from translation source settings * add color for download button dark mode * add view for no installed keyboards state * open settings on clicking Install keyboards * Fix tab bar appearance on iOS < 26 (#577) * Fix tab bar appearance on iOS < 26 * Fix tab bar appearance on iOS < 26 and adapt colors for light/dark mode * Minor comment edits --------- Co-authored-by: Andrew Tavis McAllister <andrew.t.mcallister@gmail.com> * Updated scri.be website link in About tab (#575) * Updated scri.be website link in About tab * Minor update to re-run CI * Remove unrelated AppDelegate changes from this PR * Switch icon over to a globe and change text to visit website --------- Co-authored-by: Andrew Tavis McAllister <andrew.t.mcallister@gmail.com> * Add changelog entries * Minor updates of comments in changes --------- Co-authored-by: Prince Yadav <66916296+prince-0408@users.noreply.github.com> Co-authored-by: Andrew Tavis McAllister <andrew.t.mcallister@gmail.com>
1 parent dfd7922 commit a179085

File tree

11 files changed

+622
-121
lines changed

11 files changed

+622
-121
lines changed

Scribe.xcodeproj/project.pbxproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -869,6 +869,7 @@
869869
D1E3851B2C977FD200DCE538 /* TranslationData.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = D1E3850F2C977FD100DCE538 /* TranslationData.sqlite */; };
870870
D1F0367227AAE12200CD7921 /* InterfaceVariables.swift in Sources */ = {isa = PBXBuildFile; fileRef = D190B2492741B31F00705659 /* InterfaceVariables.swift */; };
871871
D1F0367327AAE1B400CD7921 /* CommandVariables.swift in Sources */ = {isa = PBXBuildFile; fileRef = D190B2462741B24F00705659 /* CommandVariables.swift */; };
872+
E9202DF02F0FAA0C001590FC /* DownloadStateManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9202DEF2F0FAA0C001590FC /* DownloadStateManager.swift */; };
872873
E93179A42F03AE78002ED334 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = E93179A32F03AE77002ED334 /* Localizable.xcstrings */; };
873874
E937C5CF2E9FF94E00F94F99 /* TranslationData.sqlite in Resources */ = {isa = PBXBuildFile; fileRef = D1E3850F2C977FD100DCE538 /* TranslationData.sqlite */; };
874875
E96111482F04EC6B001E4F95 /* InstallationDownload.swift in Sources */ = {isa = PBXBuildFile; fileRef = E96111472F04EC62001E4F95 /* InstallationDownload.swift */; };
@@ -1216,7 +1217,7 @@
12161217
D1D8B23D2AE408C50070B817 /* French.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = French.entitlements; sourceTree = "<group>"; };
12171218
D1E3850F2C977FD100DCE538 /* TranslationData.sqlite */ = {isa = PBXFileReference; lastKnownFileType = file; path = TranslationData.sqlite; sourceTree = "<group>"; };
12181219
D1FF8ED12C6C282500EF50AC /* English.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = English.entitlements; sourceTree = "<group>"; };
1219-
E96111472F04EC62001E4F95 /* InstallationDownload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstallationDownload.swift; sourceTree = "<group>"; };
1220+
E9202DEF2F0FAA0C001590FC /* DownloadStateManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadStateManager.swift; sourceTree = "<group>"; };
12201221
E93179A32F03AE77002ED334 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; name = Localizable.xcstrings; path = i18n/i18n/Localizable.xcstrings; sourceTree = "<group>"; };
12211222
E96111472F04EC62001E4F95 /* InstallationDownload.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InstallationDownload.swift; sourceTree = "<group>"; };
12221223
E9CE5EA72F063D870068A930 /* DownloadDataScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadDataScreen.swift; sourceTree = "<group>"; };
@@ -1384,6 +1385,7 @@
13841385
isa = PBXGroup;
13851386
children = (
13861387
E96111472F04EC62001E4F95 /* InstallationDownload.swift */,
1388+
E9202DEF2F0FAA0C001590FC /* DownloadStateManager.swift */,
13871389
E9CE5EA72F063D870068A930 /* DownloadDataScreen.swift */,
13881390
38BD213522D5907F00C6795D /* InstallationVC.swift */,
13891391
);
@@ -2564,6 +2566,7 @@
25642566
D171946527AF31770038660B /* Conjugate.swift in Sources */,
25652567
147797B52A2CFB490044A53E /* SettingsViewController.swift in Sources */,
25662568
1406B7872A2DFCDD001DF45B /* AboutTableData.swift in Sources */,
2569+
E9202DF02F0FAA0C001590FC /* DownloadStateManager.swift in Sources */,
25672570
E996498A2E98AC6000200F53 /* IDInterfaceVariables.swift in Sources */,
25682571
D171940827AECCE50038660B /* PTCommandVariables.swift in Sources */,
25692572
3045396D293B9DDC003AE55B /* ToolTipViewDatasource.swift in Sources */,
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"colors": [
3+
{
4+
"color": {
5+
"color-space": "srgb",
6+
"components": {
7+
"alpha": "1.000",
8+
"blue": "0x3D",
9+
"green": "0xC5",
10+
"red": "0x9B"
11+
}
12+
},
13+
"idiom": "universal"
14+
},
15+
{
16+
"appearances": [
17+
{
18+
"appearance": "luminosity",
19+
"value": "dark"
20+
}
21+
],
22+
"color": {
23+
"color-space": "srgb",
24+
"components": {
25+
"alpha": "0.260",
26+
"blue": "0x45",
27+
"green": "0xA0",
28+
"red": "0x08"
29+
}
30+
},
31+
"idiom": "universal"
32+
}
33+
],
34+
"info": {
35+
"author": "xcode",
36+
"version": 1
37+
}
38+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"colors": [
3+
{
4+
"color": {
5+
"color-space": "srgb",
6+
"components": {
7+
"alpha": "1.000",
8+
"blue": "0x0D",
9+
"green": "0xAD",
10+
"red": "0xFD"
11+
}
12+
},
13+
"idiom": "universal"
14+
},
15+
{
16+
"appearances": [
17+
{
18+
"appearance": "luminosity",
19+
"value": "dark"
20+
}
21+
],
22+
"color": {
23+
"color-space": "srgb",
24+
"components": {
25+
"alpha": "1.000",
26+
"blue": "0x03",
27+
"green": "0x19",
28+
"red": "0x2A"
29+
}
30+
},
31+
"idiom": "universal"
32+
}
33+
],
34+
"info": {
35+
"author": "xcode",
36+
"version": 1
37+
}
38+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"colors": [
3+
{
4+
"color": {
5+
"color-space": "srgb",
6+
"components": {
7+
"alpha": "1.000",
8+
"blue": "0x00",
9+
"green": "0x00",
10+
"red": "0x00"
11+
}
12+
},
13+
"idiom": "universal"
14+
},
15+
{
16+
"appearances": [
17+
{
18+
"appearance": "luminosity",
19+
"value": "dark"
20+
}
21+
],
22+
"color": {
23+
"color-space": "srgb",
24+
"components": {
25+
"alpha": "1.000",
26+
"blue": "0x45",
27+
"green": "0xA0",
28+
"red": "0x08"
29+
}
30+
},
31+
"idiom": "universal"
32+
}
33+
],
34+
"info": {
35+
"author": "xcode",
36+
"version": 1
37+
}
38+
}

Scribe/Button/DownloadButton.swift

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
3+
/**
4+
* Download Button for making calls for updated data for each language.
5+
*/
6+
7+
import SwiftUI
8+
9+
enum ButtonState {
10+
case ready
11+
case downloading
12+
case updated
13+
case update
14+
15+
var config: ButtonConfig {
16+
switch self {
17+
case .ready:
18+
return ButtonConfig(
19+
text: NSLocalizedString(
20+
"i18n.app._global.download_data",
21+
value: "Download data",
22+
comment: ""
23+
),
24+
icon: "icloud.and.arrow.down",
25+
backgroundColor: Color("buttonOrange"),
26+
foregroundColor: Color("lightTextDarkCTA")
27+
)
28+
case .downloading:
29+
return ButtonConfig(
30+
text: NSLocalizedString(
31+
"i18n.app.download.menu_ui.download_data.downloading",
32+
value: "Downloading",
33+
comment: ""
34+
),
35+
icon: "arrow.clockwise.circle.fill",
36+
backgroundColor: Color("buttonOrange"),
37+
foregroundColor: Color("lightTextDarkCTA")
38+
)
39+
case .updated:
40+
return ButtonConfig(
41+
text: NSLocalizedString(
42+
"i18n.app.download.menu_ui.download_data.up_to_date",
43+
value: "Up to date",
44+
comment: ""
45+
),
46+
icon: "checkmark.circle.fill",
47+
backgroundColor: Color("buttonGreen"),
48+
foregroundColor: Color("lightTextDarkGreen")
49+
)
50+
case .update:
51+
return ButtonConfig(
52+
text: NSLocalizedString(
53+
"i18n.app.download.menu_ui.update_data",
54+
value: "Update data",
55+
comment: ""
56+
),
57+
icon: "icloud.and.arrow.down",
58+
backgroundColor: Color("buttonOrange"),
59+
foregroundColor: Color("lightTextDarkCTA")
60+
)
61+
}
62+
}
63+
}
64+
65+
struct ButtonConfig {
66+
let text: String
67+
let icon: String
68+
let backgroundColor: Color
69+
let foregroundColor: Color
70+
}
71+
72+
struct DownloadButton: View {
73+
let state: ButtonState
74+
let action: () -> Void
75+
@Environment(\.colorScheme) var colorScheme
76+
77+
var body: some View {
78+
Button(action: action) {
79+
HStack(spacing: 8) {
80+
Text(state.config.text)
81+
if state == .downloading {
82+
ProgressView()
83+
.tint(state.config.foregroundColor)
84+
.scaleEffect(0.8)
85+
} else {
86+
Image(systemName: state.config.icon)
87+
}
88+
}
89+
.font(.system(size: 12, weight: .semibold))
90+
.foregroundColor(state.config.foregroundColor)
91+
.frame(width: 120, height: 20)
92+
.padding(.vertical, 6)
93+
.padding(.horizontal, 10)
94+
.background(state.config.backgroundColor)
95+
.cornerRadius(6)
96+
.overlay(
97+
RoundedRectangle(cornerRadius: 6)
98+
.stroke(
99+
colorScheme == .dark ? state.config.foregroundColor : Color.clear,
100+
lineWidth: 1
101+
)
102+
)
103+
}
104+
.animation(.easeInOut(duration: 0.2), value: state)
105+
}
106+
}

0 commit comments

Comments
 (0)