Merge pull request #1 from I21b/master
This commit is contained in:
commit
1d1d61d60c
@ -54,7 +54,7 @@ class CheckInWidget : GlanceAppWidget() {
|
|||||||
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
|
.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_UNDERSCORES)
|
||||||
.registerTypeAdapter(Instant::class.java, InstantAdapter())
|
.registerTypeAdapter(Instant::class.java, InstantAdapter())
|
||||||
.create()
|
.create()
|
||||||
val resultTierSymbols = listOf("大凶", "凶", "中平", "吉", "大吉")
|
val resultTierSymbols = listOf("Bad", "Poor", "Medium", "Good", "Great")
|
||||||
|
|
||||||
val prefs = currentState.preferences
|
val prefs = currentState.preferences
|
||||||
val checkInRaw: String? = prefs.getString("pas_check_in_record", null)
|
val checkInRaw: String? = prefs.getString("pas_check_in_record", null)
|
||||||
@ -120,7 +120,7 @@ class CheckInWidget : GlanceAppWidget() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
text = "You haven't checked in today",
|
text = "You haven't divined today",
|
||||||
style = TextStyle(fontSize = 15.sp, color = GlanceTheme.colors.onSurface)
|
style = TextStyle(fontSize = 15.sp, color = GlanceTheme.colors.onSurface)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -419,7 +419,7 @@
|
|||||||
"callMessageEnded": "Call lasted {}",
|
"callMessageEnded": "Call lasted {}",
|
||||||
"callMessageStarted": "Call started",
|
"callMessageStarted": "Call started",
|
||||||
"dailyCheckIn": "Check In",
|
"dailyCheckIn": "Check In",
|
||||||
"dailyCheckInNone": "You haven't checked in today",
|
"dailyCheckInNone": "You haven't divined today",
|
||||||
"dailyCheckAction": "Check in right now!",
|
"dailyCheckAction": "Check in right now!",
|
||||||
"dailyCheckDetail": "Can't understand the symbol? Master, help me understand it!",
|
"dailyCheckDetail": "Can't understand the symbol? Master, help me understand it!",
|
||||||
"dailyCheckDetailTitle": "{}'s fortune details",
|
"dailyCheckDetailTitle": "{}'s fortune details",
|
||||||
|
@ -15,14 +15,14 @@ struct CheckInProvider: TimelineProvider {
|
|||||||
|
|
||||||
func getSnapshot(in context: Context, completion: @escaping (CheckInEntry) -> ()) {
|
func getSnapshot(in context: Context, completion: @escaping (CheckInEntry) -> ()) {
|
||||||
let prefs = UserDefaults(suiteName: "group.solsynth.solian")
|
let prefs = UserDefaults(suiteName: "group.solsynth.solian")
|
||||||
|
|
||||||
let dateFormatter = DateFormatter()
|
let dateFormatter = DateFormatter()
|
||||||
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'"
|
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSSSS'Z'"
|
||||||
|
|
||||||
let jsonDecoder = JSONDecoder()
|
let jsonDecoder = JSONDecoder()
|
||||||
jsonDecoder.dateDecodingStrategy = .formatted(dateFormatter)
|
jsonDecoder.dateDecodingStrategy = .formatted(dateFormatter)
|
||||||
jsonDecoder.keyDecodingStrategy = .convertFromSnakeCase
|
jsonDecoder.keyDecodingStrategy = .convertFromSnakeCase
|
||||||
|
|
||||||
let checkInRaw = prefs?.string(forKey: "pas_check_in_record")
|
let checkInRaw = prefs?.string(forKey: "pas_check_in_record")
|
||||||
var checkIn: SolarCheckInRecord?
|
var checkIn: SolarCheckInRecord?
|
||||||
if let checkInRaw = checkInRaw {
|
if let checkInRaw = checkInRaw {
|
||||||
@ -31,7 +31,7 @@ struct CheckInProvider: TimelineProvider {
|
|||||||
checkIn = nil
|
checkIn = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let entry = CheckInEntry(
|
let entry = CheckInEntry(
|
||||||
date: Date(),
|
date: Date(),
|
||||||
checkIn: checkIn
|
checkIn: checkIn
|
||||||
@ -54,11 +54,11 @@ struct CheckInEntry: TimelineEntry {
|
|||||||
|
|
||||||
struct CheckInWidgetEntryView : View {
|
struct CheckInWidgetEntryView : View {
|
||||||
var entry: CheckInProvider.Entry
|
var entry: CheckInProvider.Entry
|
||||||
|
|
||||||
private let resultTierSymbols: [String] = ["大凶", "凶", "中平", "吉", "大吉"]
|
private let resultTierSymbols: [String] = ["Bad", "Poor", "Medium", "Good", "Great"]
|
||||||
|
|
||||||
func checkIn() -> Void {}
|
func checkIn() -> Void {}
|
||||||
|
|
||||||
func seeDetail() -> Void {}
|
func seeDetail() -> Void {}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
@ -68,9 +68,9 @@ struct CheckInWidgetEntryView : View {
|
|||||||
Text(resultTierSymbols[checkIn.resultTier]).font(.system(size: 27, weight: .bold))
|
Text(resultTierSymbols[checkIn.resultTier]).font(.system(size: 27, weight: .bold))
|
||||||
Text("+\(checkIn.resultExperience) EXP").font(.system(size: 15, design: .monospaced))
|
Text("+\(checkIn.resultExperience) EXP").font(.system(size: 15, design: .monospaced))
|
||||||
}.padding(.horizontal, 4)
|
}.padding(.horizontal, 4)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
HStack {
|
HStack {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
Text(
|
Text(
|
||||||
@ -82,7 +82,7 @@ struct CheckInWidgetEntryView : View {
|
|||||||
format: .dateTime.day().month()
|
format: .dateTime.day().month()
|
||||||
).font(.system(size: 13))
|
).font(.system(size: 13))
|
||||||
}.padding(.leading, 4)
|
}.padding(.leading, 4)
|
||||||
|
|
||||||
Button("See Detail", systemImage: "arrow.right", action: seeDetail)
|
Button("See Detail", systemImage: "arrow.right", action: seeDetail)
|
||||||
.labelStyle(.iconOnly)
|
.labelStyle(.iconOnly)
|
||||||
.buttonBorderShape(.circle)
|
.buttonBorderShape(.circle)
|
||||||
@ -91,11 +91,11 @@ struct CheckInWidgetEntryView : View {
|
|||||||
} else {
|
} else {
|
||||||
VStack(alignment: .leading) {
|
VStack(alignment: .leading) {
|
||||||
Text("Check In").font(.system(size: 19, weight: .bold))
|
Text("Check In").font(.system(size: 19, weight: .bold))
|
||||||
Text("You haven't check in today").font(.system(size: 15))
|
Text("You haven't divined today").font(.system(size: 15))
|
||||||
}.padding(.horizontal, 4)
|
}.padding(.horizontal, 4)
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
HStack(alignment: .bottom) {
|
HStack(alignment: .bottom) {
|
||||||
Button("Check In", systemImage: "checkmark", action: checkIn).labelStyle(.iconOnly).buttonBorderShape(.circle).frame(maxWidth: .infinity, alignment: .trailing)
|
Button("Check In", systemImage: "checkmark", action: checkIn).labelStyle(.iconOnly).buttonBorderShape(.circle).frame(maxWidth: .infinity, alignment: .trailing)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,7 @@ import 'package:freezed_annotation/freezed_annotation.dart';
|
|||||||
part 'check_in.freezed.dart';
|
part 'check_in.freezed.dart';
|
||||||
part 'check_in.g.dart';
|
part 'check_in.g.dart';
|
||||||
|
|
||||||
const List<String> kCheckInResultTierSymbols = ['大凶', '凶', '中平', '吉', '大吉'];
|
const List<String> kCheckInResultTierSymbols = ['Bad', 'Poor', 'Medium', 'Good', 'Great'];
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
class SnCheckInRecord with _$SnCheckInRecord {
|
class SnCheckInRecord with _$SnCheckInRecord {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user