From 039d812a6581383629241c43ca0cc5727e92bdc7 Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Sun, 22 Sep 2024 16:25:41 +0900 Subject: [PATCH 01/16] add some improvements for hiding --- LiveContainerSwiftUI/LCAppBanner.swift | 2 +- LiveContainerSwiftUI/LCAppListView.swift | 55 ++++++++++++++------ LiveContainerSwiftUI/LCAppSettingsView.swift | 20 ++++--- LiveContainerSwiftUI/LCSettingsView.swift | 12 ++--- 4 files changed, 53 insertions(+), 36 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppBanner.swift b/LiveContainerSwiftUI/LCAppBanner.swift index 17445d9..6cd3fd3 100644 --- a/LiveContainerSwiftUI/LCAppBanner.swift +++ b/LiveContainerSwiftUI/LCAppBanner.swift @@ -108,7 +108,7 @@ struct LCAppBanner : View { }) .clipShape(Capsule()) - .disabled(model.isAppRunning) + .disabled(model.isAppRunning || (model.uiIsHidden && !sharedModel.isHiddenAppUnlocked)) } .padding() diff --git a/LiveContainerSwiftUI/LCAppListView.swift b/LiveContainerSwiftUI/LCAppListView.swift index 17ee1e5..f356bd1 100644 --- a/LiveContainerSwiftUI/LCAppListView.swift +++ b/LiveContainerSwiftUI/LCAppListView.swift @@ -95,16 +95,30 @@ struct LCAppListView : View, LCAppBannerDelegate, LCAppModelDelegate { } .padding() .animation(.easeInOut, value: apps) - - if !sharedModel.isHiddenAppUnlocked { - Text(apps.count > 0 ? "lc.appList.appCounter %lld".localizeWithFormat(apps.count) : "lc.appList.installTip".loc).foregroundStyle(.gray) - .onTapGesture(count: 3) { - Task { await authenticateUser() } - } - } - - if sharedModel.isHiddenAppUnlocked { + if LCUtils.appGroupUserDefault.bool(forKey: "LCStrictHiding") { + if sharedModel.isHiddenAppUnlocked { + LazyVStack { + HStack { + Text("lc.appList.hiddenApps".loc) + .font(.system(.title2).bold()) + .border(Color.black) + Spacer() + } + ForEach(hiddenApps, id: \.self) { app in + LCAppBanner(appModel: app, delegate: self, appDataFolders: $appDataFolderNames, tweakFolders: $tweakFolderNames) + } + .transition(.scale) + } + .padding() + .animation(.easeInOut, value: apps) + + if hiddenApps.count == 0 { + Text("lc.appList.hideAppTip".loc) + .foregroundStyle(.gray) + } + } + } else if hiddenApps.count > 0 { LazyVStack { HStack { Text("lc.appList.hiddenApps".loc) @@ -115,18 +129,25 @@ struct LCAppListView : View, LCAppBannerDelegate, LCAppModelDelegate { ForEach(hiddenApps, id: \.self) { app in LCAppBanner(appModel: app, delegate: self, appDataFolders: $appDataFolderNames, tweakFolders: $tweakFolderNames) } - .transition(.scale) + .blur(radius: sharedModel.isHiddenAppUnlocked ? 0 : 8.0) + .clipShape(RoundedRectangle(cornerSize: CGSize(width:22, height: 22))) + .animation(.easeInOut, value: sharedModel.isHiddenAppUnlocked) + .onTapGesture { + Task { await authenticateUser() } + } } .padding() .animation(.easeInOut, value: apps) - - if hiddenApps.count == 0 { - Text("lc.appList.hideAppTip".loc) - .foregroundStyle(.gray) - } - Text(apps.count + hiddenApps.count > 0 ? "lc.appList.appCounter %lld".localizeWithFormat(apps.count + hiddenApps.count) : "lc.appList.installTip".loc).foregroundStyle(.gray) } - + + let appCount = sharedModel.isHiddenAppUnlocked ? apps.count + hiddenApps.count : apps.count + Text(appCount > 0 ? "lc.appList.appCounter %lld".localizeWithFormat(appCount) : "lc.appList.installTip".loc) + .foregroundStyle(.gray) + .animation(.easeInOut, value: appCount) + .onTapGesture(count: 3) { + Task { await authenticateUser() } + } + if LCUtils.multiLCStatus == 2 { Text("lc.appList.manageInPrimaryTip".loc).foregroundStyle(.gray).padding() } diff --git a/LiveContainerSwiftUI/LCAppSettingsView.swift b/LiveContainerSwiftUI/LCAppSettingsView.swift index 13d2f53..ea46e8d 100644 --- a/LiveContainerSwiftUI/LCAppSettingsView.swift +++ b/LiveContainerSwiftUI/LCAppSettingsView.swift @@ -154,19 +154,17 @@ struct LCAppSettingsView : View{ Text("lc.appSettings.launchWithJitDesc".loc) } - if sharedModel.isHiddenAppUnlocked { - Section { - Toggle(isOn: $model.uiIsHidden) { - Text("lc.appSettings.hideApp".loc) - } - .onChange(of: model.uiIsHidden, perform: { newValue in - Task { await toggleHidden() } - }) - } footer: { - Text("lc.appSettings.hideAppDesc".loc) + Section { + Toggle(isOn: $model.uiIsHidden) { + Text("lc.appSettings.hideApp".loc) } - + .onChange(of: model.uiIsHidden, perform: { newValue in + Task { await toggleHidden() } + }) + } footer: { + Text("lc.appSettings.hideAppDesc".loc) } + Section { Toggle(isOn: $model.uiDoSymlinkInbox) { diff --git a/LiveContainerSwiftUI/LCSettingsView.swift b/LiveContainerSwiftUI/LCSettingsView.swift index 29c96e8..2f404db 100644 --- a/LiveContainerSwiftUI/LCSettingsView.swift +++ b/LiveContainerSwiftUI/LCSettingsView.swift @@ -157,14 +157,12 @@ struct LCSettingsView: View { Text("lc.settings.injectLCItselfDesc".loc) } - if sharedModel.isHiddenAppUnlocked { - Section { - Toggle(isOn: $strictHiding) { - Text("lc.settings.strictHiding".loc) - } - } footer: { - Text("lc.settings.strictHidingDesc".loc) + Section { + Toggle(isOn: $strictHiding) { + Text("lc.settings.strictHiding".loc) } + } footer: { + Text("lc.settings.strictHidingDesc".loc) } Section { From 1f11929cb77b1dc5a6de2f2f7e23023514415535 Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 07:40:54 +0900 Subject: [PATCH 02/16] show skelton screen --- LiveContainerSwiftUI/LCAppBanner.swift | 36 +++++++++++++++++++++++- LiveContainerSwiftUI/LCAppListView.swift | 3 +- 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppBanner.swift b/LiveContainerSwiftUI/LCAppBanner.swift index 6cd3fd3..2ab5767 100644 --- a/LiveContainerSwiftUI/LCAppBanner.swift +++ b/LiveContainerSwiftUI/LCAppBanner.swift @@ -108,7 +108,7 @@ struct LCAppBanner : View { }) .clipShape(Capsule()) - .disabled(model.isAppRunning || (model.uiIsHidden && !sharedModel.isHiddenAppUnlocked)) + .disabled(model.isAppRunning) } .padding() @@ -319,3 +319,37 @@ struct LCAppBanner : View { } + + +struct LCAppSkeletonBanner: View { + var body: some View { + HStack { + RoundedRectangle(cornerRadius: 12) + .fill(Color.gray.opacity(0.3)) + .frame(width: 60, height: 60) + + VStack(alignment: .leading, spacing: 5) { + RoundedRectangle(cornerRadius: 4) + .fill(Color.gray.opacity(0.3)) + .frame(width: 100, height: 16) + + RoundedRectangle(cornerRadius: 4) + .fill(Color.gray.opacity(0.3)) + .frame(width: 150, height: 12) + + RoundedRectangle(cornerRadius: 4) + .fill(Color.gray.opacity(0.3)) + .frame(width: 120, height: 8) + } + + Spacer() + + RoundedRectangle(cornerRadius: 16) + .fill(Color.gray.opacity(0.3)) + .frame(width: 70, height: 32) + } + .padding() + .frame(height: 88) + .background(RoundedRectangle(cornerRadius: 22).fill(Color.gray.opacity(0.1))) + } +} diff --git a/LiveContainerSwiftUI/LCAppListView.swift b/LiveContainerSwiftUI/LCAppListView.swift index f356bd1..00510fe 100644 --- a/LiveContainerSwiftUI/LCAppListView.swift +++ b/LiveContainerSwiftUI/LCAppListView.swift @@ -127,7 +127,8 @@ struct LCAppListView : View, LCAppBannerDelegate, LCAppModelDelegate { Spacer() } ForEach(hiddenApps, id: \.self) { app in - LCAppBanner(appModel: app, delegate: self, appDataFolders: $appDataFolderNames, tweakFolders: $tweakFolderNames) + sharedModel.isHiddenAppUnlocked ? + LCAppBanner(appModel: app, delegate: self, appDataFolders: $appDataFolderNames, tweakFolders: $tweakFolderNames) : LCAppSkeletonBanner() } .blur(radius: sharedModel.isHiddenAppUnlocked ? 0 : 8.0) .clipShape(RoundedRectangle(cornerSize: CGSize(width:22, height: 22))) From 051e945e08863703bcaf8bf8ba1f204678637064 Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 07:54:19 +0900 Subject: [PATCH 03/16] fix build err --- LiveContainerSwiftUI/LCAppListView.swift | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppListView.swift b/LiveContainerSwiftUI/LCAppListView.swift index 00510fe..bd9fcdf 100644 --- a/LiveContainerSwiftUI/LCAppListView.swift +++ b/LiveContainerSwiftUI/LCAppListView.swift @@ -127,11 +127,12 @@ struct LCAppListView : View, LCAppBannerDelegate, LCAppModelDelegate { Spacer() } ForEach(hiddenApps, id: \.self) { app in - sharedModel.isHiddenAppUnlocked ? - LCAppBanner(appModel: app, delegate: self, appDataFolders: $appDataFolderNames, tweakFolders: $tweakFolderNames) : LCAppSkeletonBanner() + if sharedModel.isHiddenAppUnlocked { + LCAppBanner(appModel: app, delegate: self, appDataFolders: $appDataFolderNames, tweakFolders: $tweakFolderNames) + } else { + LCAppSkeletonBanner() + } } - .blur(radius: sharedModel.isHiddenAppUnlocked ? 0 : 8.0) - .clipShape(RoundedRectangle(cornerSize: CGSize(width:22, height: 22))) .animation(.easeInOut, value: sharedModel.isHiddenAppUnlocked) .onTapGesture { Task { await authenticateUser() } From 195b175cbcd79078128c0999020dc0a3bd666fa1 Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 08:23:54 +0900 Subject: [PATCH 04/16] fix strict hide isn't applied immediately --- LiveContainerSwiftUI/LCAppListView.swift | 78 ++++++++++++------------ 1 file changed, 40 insertions(+), 38 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppListView.swift b/LiveContainerSwiftUI/LCAppListView.swift index bd9fcdf..447a50a 100644 --- a/LiveContainerSwiftUI/LCAppListView.swift +++ b/LiveContainerSwiftUI/LCAppListView.swift @@ -96,8 +96,30 @@ struct LCAppListView : View, LCAppBannerDelegate, LCAppModelDelegate { .padding() .animation(.easeInOut, value: apps) - if LCUtils.appGroupUserDefault.bool(forKey: "LCStrictHiding") { - if sharedModel.isHiddenAppUnlocked { + VStack { + if LCUtils.appGroupUserDefault.bool(forKey: "LCStrictHiding") { + if sharedModel.isHiddenAppUnlocked { + LazyVStack { + HStack { + Text("lc.appList.hiddenApps".loc) + .font(.system(.title2).bold()) + .border(Color.black) + Spacer() + } + ForEach(hiddenApps, id: \.self) { app in + LCAppBanner(appModel: app, delegate: self, appDataFolders: $appDataFolderNames, tweakFolders: $tweakFolderNames) + } + } + .padding() + .transition(.opacity) + .animation(.easeInOut, value: apps) + + if hiddenApps.count == 0 { + Text("lc.appList.hideAppTip".loc) + .foregroundStyle(.gray) + } + } + } else if hiddenApps.count > 0 { LazyVStack { HStack { Text("lc.appList.hiddenApps".loc) @@ -106,49 +128,29 @@ struct LCAppListView : View, LCAppBannerDelegate, LCAppModelDelegate { Spacer() } ForEach(hiddenApps, id: \.self) { app in - LCAppBanner(appModel: app, delegate: self, appDataFolders: $appDataFolderNames, tweakFolders: $tweakFolderNames) + if sharedModel.isHiddenAppUnlocked { + LCAppBanner(appModel: app, delegate: self, appDataFolders: $appDataFolderNames, tweakFolders: $tweakFolderNames) + } else { + LCAppSkeletonBanner() + } + } + .animation(.easeInOut, value: sharedModel.isHiddenAppUnlocked) + .onTapGesture { + Task { await authenticateUser() } } - .transition(.scale) } .padding() .animation(.easeInOut, value: apps) - - if hiddenApps.count == 0 { - Text("lc.appList.hideAppTip".loc) - .foregroundStyle(.gray) - } } - } else if hiddenApps.count > 0 { - LazyVStack { - HStack { - Text("lc.appList.hiddenApps".loc) - .font(.system(.title2).bold()) - .border(Color.black) - Spacer() - } - ForEach(hiddenApps, id: \.self) { app in - if sharedModel.isHiddenAppUnlocked { - LCAppBanner(appModel: app, delegate: self, appDataFolders: $appDataFolderNames, tweakFolders: $tweakFolderNames) - } else { - LCAppSkeletonBanner() - } - } - .animation(.easeInOut, value: sharedModel.isHiddenAppUnlocked) - .onTapGesture { + + let appCount = sharedModel.isHiddenAppUnlocked ? apps.count + hiddenApps.count : apps.count + Text(appCount > 0 ? "lc.appList.appCounter %lld".localizeWithFormat(appCount) : "lc.appList.installTip".loc) + .foregroundStyle(.gray) + .animation(.easeInOut, value: appCount) + .onTapGesture(count: 3) { Task { await authenticateUser() } } - } - .padding() - .animation(.easeInOut, value: apps) - } - - let appCount = sharedModel.isHiddenAppUnlocked ? apps.count + hiddenApps.count : apps.count - Text(appCount > 0 ? "lc.appList.appCounter %lld".localizeWithFormat(appCount) : "lc.appList.installTip".loc) - .foregroundStyle(.gray) - .animation(.easeInOut, value: appCount) - .onTapGesture(count: 3) { - Task { await authenticateUser() } - } + }.animation(.easeInOut, value: LCUtils.appGroupUserDefault.bool(forKey: "LCStrictHiding")) if LCUtils.multiLCStatus == 2 { Text("lc.appList.manageInPrimaryTip".loc).foregroundStyle(.gray).padding() From c15e3486dcaf703ed61e60142d3e0d7eca8fe6d9 Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:09:49 +0900 Subject: [PATCH 05/16] add locking support...? --- LiveContainerSwiftUI/LCAppBanner.swift | 7 ++++ LiveContainerSwiftUI/LCAppListView.swift | 3 +- LiveContainerSwiftUI/LCAppModel.swift | 12 +++++++ LiveContainerSwiftUI/LCAppSettingsView.swift | 22 +++++++++---- LiveContainerSwiftUI/Localizable.xcstrings | 34 ++++++++++++++++++++ LiveContainerUI/LCAppInfo.h | 1 + LiveContainerUI/LCAppInfo.m | 15 ++++++++- TweakLoader/UIKit+GuestHooks.m | 2 +- 8 files changed, 86 insertions(+), 10 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppBanner.swift b/LiveContainerSwiftUI/LCAppBanner.swift index 2ab5767..beca3d7 100644 --- a/LiveContainerSwiftUI/LCAppBanner.swift +++ b/LiveContainerSwiftUI/LCAppBanner.swift @@ -71,6 +71,13 @@ struct LCAppBanner : View { Capsule().fill(Color("JITBadgeColor")) ) } + if model.uiIsLocked { + Text("lc.appBanner.locked".loc).font(.system(size: 8)).bold().padding(2) + .frame(width: 50, height:16) + .background( + Capsule().fill(Color("BadgeColor")) + ) + } } Text("\(appInfo.version()) - \(appInfo.bundleIdentifier())").font(.system(size: 12)).foregroundColor(Color("FontColor")) diff --git a/LiveContainerSwiftUI/LCAppListView.swift b/LiveContainerSwiftUI/LCAppListView.swift index 447a50a..51e4eb6 100644 --- a/LiveContainerSwiftUI/LCAppListView.swift +++ b/LiveContainerSwiftUI/LCAppListView.swift @@ -48,7 +48,7 @@ struct LCAppListView : View, LCAppBannerDelegate, LCAppModelDelegate { @State private var isNavigationActive = false @EnvironmentObject private var sharedModel : SharedModel - + init(apps: Binding<[LCAppModel]>, hiddenApps: Binding<[LCAppModel]>, appDataFolderNames: Binding<[String]>, tweakFolderNames: Binding<[String]>) { _installOptions = State(initialValue: []) _apps = apps @@ -103,7 +103,6 @@ struct LCAppListView : View, LCAppBannerDelegate, LCAppModelDelegate { HStack { Text("lc.appList.hiddenApps".loc) .font(.system(.title2).bold()) - .border(Color.black) Spacer() } ForEach(hiddenApps, id: \.self) { app in diff --git a/LiveContainerSwiftUI/LCAppModel.swift b/LiveContainerSwiftUI/LCAppModel.swift index f24f815..e2bc462 100644 --- a/LiveContainerSwiftUI/LCAppModel.swift +++ b/LiveContainerSwiftUI/LCAppModel.swift @@ -16,6 +16,7 @@ class LCAppModel: ObservableObject, Hashable { @Published var uiIsJITNeeded : Bool @Published var uiIsHidden : Bool + @Published var uiIsLocked : Bool @Published var uiIsShared : Bool @Published var uiDataFolder : String? @Published var uiTweakFolder : String? @@ -32,6 +33,7 @@ class LCAppModel: ObservableObject, Hashable { self.uiIsJITNeeded = appInfo.isJITNeeded self.uiIsHidden = appInfo.isHidden + self.uiIsLocked = appInfo.isLocked self.uiIsShared = appInfo.isShared self.uiDataFolder = appInfo.getDataUUIDNoAssign() self.uiTweakFolder = appInfo.tweakFolder() @@ -121,6 +123,16 @@ class LCAppModel: ObservableObject, Hashable { LCUtils.launchToGuestApp() } + + func toggleLocked() async { + if appInfo.isLocked { + appInfo.isLocked = false + uiIsLocked = false + } else { + appInfo.isLocked = true + uiIsLocked = true + } + } func toggleHidden() async { delegate?.closeNavigationView() diff --git a/LiveContainerSwiftUI/LCAppSettingsView.swift b/LiveContainerSwiftUI/LCAppSettingsView.swift index ea46e8d..3c2d4f5 100644 --- a/LiveContainerSwiftUI/LCAppSettingsView.swift +++ b/LiveContainerSwiftUI/LCAppSettingsView.swift @@ -153,16 +153,26 @@ struct LCAppSettingsView : View{ } footer: { Text("lc.appSettings.launchWithJitDesc".loc) } - + Section { - Toggle(isOn: $model.uiIsHidden) { - Text("lc.appSettings.hideApp".loc) + Toggle(isOn: $model.uiIsLocked) { + Text("lc.appSettings.lockApp".loc) } - .onChange(of: model.uiIsHidden, perform: { newValue in - Task { await toggleHidden() } + .onChange(of: model.uiIsLocked, perform: { newValue in + Task { await model.toggleLock() } }) + if model.uiIsLocked { + Toggle(isOn: $model.uiIsHidden) { + Text("lc.appSettings.hideApp".loc) + } + .onChange(of: model.uiIsHidden, perform: { newValue in + Task { await toggleHidden() } + }) + } } footer: { - Text("lc.appSettings.hideAppDesc".loc) + if model.uiIsLocked { + Text("lc.appSettings.hideAppDesc".loc) + } } diff --git a/LiveContainerSwiftUI/Localizable.xcstrings b/LiveContainerSwiftUI/Localizable.xcstrings index 4a8a083..83f643f 100644 --- a/LiveContainerSwiftUI/Localizable.xcstrings +++ b/LiveContainerSwiftUI/Localizable.xcstrings @@ -222,6 +222,23 @@ } } }, + "lc.appBanner.locked" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "LOCKED" + } + }, + "zh_CN" : { + "stringUnit" : { + "state" : "translated", + "value" : "锁定" + } + } + } + }, "lc.appBanner.uninstall" : { "extractionState" : "manual", "localizations" : { @@ -790,6 +807,23 @@ } } }, + "lc.appSettings.lockApp" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Lock App" + } + }, + "zh_CN" : { + "stringUnit" : { + "state" : "translated", + "value" : "锁定App" + } + } + } + }, "lc.appSettings.hideApp" : { "extractionState" : "manual", "localizations" : { diff --git a/LiveContainerUI/LCAppInfo.h b/LiveContainerUI/LCAppInfo.h index 329f241..f64e909 100644 --- a/LiveContainerUI/LCAppInfo.h +++ b/LiveContainerUI/LCAppInfo.h @@ -8,6 +8,7 @@ @property NSString* relativeBundlePath; @property bool isShared; @property bool isJITNeeded; +@property bool isLocked; @property bool isHidden; @property bool doSymlinkInbox; @property bool bypassAssertBarrierOnQueue; diff --git a/LiveContainerUI/LCAppInfo.m b/LiveContainerUI/LCAppInfo.m index e88b306..ea31f82 100644 --- a/LiveContainerUI/LCAppInfo.m +++ b/LiveContainerUI/LCAppInfo.m @@ -9,7 +9,7 @@ @implementation LCAppInfo - (instancetype)initWithBundlePath:(NSString*)bundlePath { self = [super init]; self.isShared = false; - if(self) { + if(self) { _bundlePath = bundlePath; _info = [NSMutableDictionary dictionaryWithContentsOfFile:[NSString stringWithFormat:@"%@/Info.plist", bundlePath]]; @@ -293,6 +293,19 @@ - (void)setIsJITNeeded:(bool)isJITNeeded { } +- (bool)isLocked { + if(_info[@"isLocked"] != nil) { + return [_info[@"isLocked"] boolValue]; + } else { + return NO; + } +} +- (void)setIsLocked:(bool)isLocked { + _info[@"isLocked"] = [NSNumber numberWithBool:isLocked]; + [self save]; + +} + - (bool)isHidden { if(_info[@"isHidden"] != nil) { return [_info[@"isHidden"] boolValue]; diff --git a/TweakLoader/UIKit+GuestHooks.m b/TweakLoader/UIKit+GuestHooks.m index 678ef0a..6a590ea 100644 --- a/TweakLoader/UIKit+GuestHooks.m +++ b/TweakLoader/UIKit+GuestHooks.m @@ -174,7 +174,7 @@ void handleLiveContainerLaunch(NSURL* url) { NSBundle* bundle = [NSClassFromString(@"LCSharedUtils") findBundleWithBundleId: bundleName]; if(!bundle || ([bundle.infoDictionary[@"isHidden"] boolValue] && [NSUserDefaults.lcSharedDefaults boolForKey:@"LCStrictHiding"])) { LCShowAppNotFoundAlert(bundleName); - } else if ([bundle.infoDictionary[@"isHidden"] boolValue]) { + } else if ([bundle.infoDictionary[@"isLocked"] boolValue]) { // need authentication authenticateUser(^(BOOL success, NSError *error) { if (success) { From a357f4b2255f30656f20ffb2f60b1fc00b08d2f5 Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:19:44 +0900 Subject: [PATCH 06/16] fix err --- LiveContainerSwiftUI/LCAppSettingsView.swift | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppSettingsView.swift b/LiveContainerSwiftUI/LCAppSettingsView.swift index 3c2d4f5..5d9eb4f 100644 --- a/LiveContainerSwiftUI/LCAppSettingsView.swift +++ b/LiveContainerSwiftUI/LCAppSettingsView.swift @@ -161,14 +161,14 @@ struct LCAppSettingsView : View{ .onChange(of: model.uiIsLocked, perform: { newValue in Task { await model.toggleLock() } }) - if model.uiIsLocked { - Toggle(isOn: $model.uiIsHidden) { - Text("lc.appSettings.hideApp".loc) - } - .onChange(of: model.uiIsHidden, perform: { newValue in - Task { await toggleHidden() } - }) + + Toggle(isOn: $model.uiIsHidden) { + Text("lc.appSettings.hideApp".loc) } + .onChange(of: model.uiIsHidden, perform: { newValue in + Task { await toggleHidden() } + }) + .disabled(!model.uiIsLocked) } footer: { if model.uiIsLocked { Text("lc.appSettings.hideAppDesc".loc) From d9b561f1de6719283b75613aca5f239d8cdefe49 Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:35:12 +0900 Subject: [PATCH 07/16] fix...? --- LiveContainerSwiftUI/LCAppSettingsView.swift | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppSettingsView.swift b/LiveContainerSwiftUI/LCAppSettingsView.swift index 5d9eb4f..37f7761 100644 --- a/LiveContainerSwiftUI/LCAppSettingsView.swift +++ b/LiveContainerSwiftUI/LCAppSettingsView.swift @@ -161,18 +161,17 @@ struct LCAppSettingsView : View{ .onChange(of: model.uiIsLocked, perform: { newValue in Task { await model.toggleLock() } }) + } + Section { Toggle(isOn: $model.uiIsHidden) { Text("lc.appSettings.hideApp".loc) } .onChange(of: model.uiIsHidden, perform: { newValue in Task { await toggleHidden() } }) - .disabled(!model.uiIsLocked) } footer: { - if model.uiIsLocked { - Text("lc.appSettings.hideAppDesc".loc) - } + Text("lc.appSettings.hideAppDesc".loc) } From 869cdf78ab549c29d1f2b6a497811bd0fb810d4a Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:40:34 +0900 Subject: [PATCH 08/16] lock --- LiveContainerSwiftUI/LCAppSettingsView.swift | 9 --------- 1 file changed, 9 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppSettingsView.swift b/LiveContainerSwiftUI/LCAppSettingsView.swift index 37f7761..a4d83e9 100644 --- a/LiveContainerSwiftUI/LCAppSettingsView.swift +++ b/LiveContainerSwiftUI/LCAppSettingsView.swift @@ -154,15 +154,6 @@ struct LCAppSettingsView : View{ Text("lc.appSettings.launchWithJitDesc".loc) } - Section { - Toggle(isOn: $model.uiIsLocked) { - Text("lc.appSettings.lockApp".loc) - } - .onChange(of: model.uiIsLocked, perform: { newValue in - Task { await model.toggleLock() } - }) - } - Section { Toggle(isOn: $model.uiIsHidden) { Text("lc.appSettings.hideApp".loc) From b05b15171e7fa595cce36474d10993027a0b8396 Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:49:13 +0900 Subject: [PATCH 09/16] a --- LiveContainerSwiftUI/LCAppListView.swift | 1 - LiveContainerSwiftUI/LCAppSettingsView.swift | 11 ++++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppListView.swift b/LiveContainerSwiftUI/LCAppListView.swift index 51e4eb6..8db6207 100644 --- a/LiveContainerSwiftUI/LCAppListView.swift +++ b/LiveContainerSwiftUI/LCAppListView.swift @@ -123,7 +123,6 @@ struct LCAppListView : View, LCAppBannerDelegate, LCAppModelDelegate { HStack { Text("lc.appList.hiddenApps".loc) .font(.system(.title2).bold()) - .border(Color.black) Spacer() } ForEach(hiddenApps, id: \.self) { app in diff --git a/LiveContainerSwiftUI/LCAppSettingsView.swift b/LiveContainerSwiftUI/LCAppSettingsView.swift index a4d83e9..6c31f35 100644 --- a/LiveContainerSwiftUI/LCAppSettingsView.swift +++ b/LiveContainerSwiftUI/LCAppSettingsView.swift @@ -154,11 +154,20 @@ struct LCAppSettingsView : View{ Text("lc.appSettings.launchWithJitDesc".loc) } + Section { + Toggle(isOn: $model.uiIsLocked) { + Text("lc.appSettings.lockApp".loc) + } + .onChange(of: model.uiIsLocked, perform: { _ in + Task { await model.toggleLock() } + }) + } + Section { Toggle(isOn: $model.uiIsHidden) { Text("lc.appSettings.hideApp".loc) } - .onChange(of: model.uiIsHidden, perform: { newValue in + .onChange(of: model.uiIsHidden, perform: { _ in Task { await toggleHidden() } }) } footer: { From 3b9ea619495e573ce4fc6a98b6bbc7a0be4c9ef0 Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:49:31 +0900 Subject: [PATCH 10/16] a --- LiveContainerSwiftUI/LCAppSettingsView.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppSettingsView.swift b/LiveContainerSwiftUI/LCAppSettingsView.swift index 6c31f35..e9589dc 100644 --- a/LiveContainerSwiftUI/LCAppSettingsView.swift +++ b/LiveContainerSwiftUI/LCAppSettingsView.swift @@ -158,9 +158,9 @@ struct LCAppSettingsView : View{ Toggle(isOn: $model.uiIsLocked) { Text("lc.appSettings.lockApp".loc) } - .onChange(of: model.uiIsLocked, perform: { _ in - Task { await model.toggleLock() } - }) + // .onChange(of: model.uiIsLocked, perform: { _ in + // Task { await model.toggleLock() } + // }) } Section { From 6ff419680cea08503b7e96440279678addb99abd Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:56:54 +0900 Subject: [PATCH 11/16] a --- LiveContainerSwiftUI/LCAppModel.swift | 2 +- LiveContainerSwiftUI/LCAppSettingsView.swift | 24 +++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppModel.swift b/LiveContainerSwiftUI/LCAppModel.swift index e2bc462..e7a6091 100644 --- a/LiveContainerSwiftUI/LCAppModel.swift +++ b/LiveContainerSwiftUI/LCAppModel.swift @@ -124,7 +124,7 @@ class LCAppModel: ObservableObject, Hashable { } - func toggleLocked() async { + func toggleLock() async { if appInfo.isLocked { appInfo.isLocked = false uiIsLocked = false diff --git a/LiveContainerSwiftUI/LCAppSettingsView.swift b/LiveContainerSwiftUI/LCAppSettingsView.swift index e9589dc..dcfb1ac 100644 --- a/LiveContainerSwiftUI/LCAppSettingsView.swift +++ b/LiveContainerSwiftUI/LCAppSettingsView.swift @@ -158,20 +158,22 @@ struct LCAppSettingsView : View{ Toggle(isOn: $model.uiIsLocked) { Text("lc.appSettings.lockApp".loc) } - // .onChange(of: model.uiIsLocked, perform: { _ in - // Task { await model.toggleLock() } - // }) - } + .onChange(of: model.uiIsLocked, perform: { _ in + Task { await model.toggleLock() } + }) - Section { - Toggle(isOn: $model.uiIsHidden) { - Text("lc.appSettings.hideApp".loc) + if model.uiIsLocked { + Toggle(isOn: $model.uiIsHidden) { + Text("lc.appSettings.hideApp".loc) + } + .onChange(of: model.uiIsHidden, perform: { _ in + Task { await toggleHidden() } + }) } - .onChange(of: model.uiIsHidden, perform: { _ in - Task { await toggleHidden() } - }) } footer: { - Text("lc.appSettings.hideAppDesc".loc) + if model.uiIsLocked { + Text("lc.appSettings.hideAppDesc".loc) + } } From ae23ca4ce7dd66923af8a6e8fa520569a6c95e3e Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 11:59:59 +0900 Subject: [PATCH 12/16] add transition --- LiveContainerSwiftUI/LCAppSettingsView.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/LiveContainerSwiftUI/LCAppSettingsView.swift b/LiveContainerSwiftUI/LCAppSettingsView.swift index dcfb1ac..97fb00a 100644 --- a/LiveContainerSwiftUI/LCAppSettingsView.swift +++ b/LiveContainerSwiftUI/LCAppSettingsView.swift @@ -169,10 +169,12 @@ struct LCAppSettingsView : View{ .onChange(of: model.uiIsHidden, perform: { _ in Task { await toggleHidden() } }) + .transition(.opacity.combined(with: .slide)) } } footer: { if model.uiIsLocked { Text("lc.appSettings.hideAppDesc".loc) + .transition(.opacity.combined(with: .slide)) } } From 8f992dfbed49c0a405c4a91f10a5a23f5a056327 Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 12:53:12 +0900 Subject: [PATCH 13/16] some fix --- LiveContainerSwiftUI/LCAppListView.swift | 9 ++++++--- LiveContainerSwiftUI/LCAppModel.swift | 16 ++++++++++++++++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppListView.swift b/LiveContainerSwiftUI/LCAppListView.swift index 8db6207..b28a069 100644 --- a/LiveContainerSwiftUI/LCAppListView.swift +++ b/LiveContainerSwiftUI/LCAppListView.swift @@ -483,10 +483,13 @@ struct LCAppListView : View, LCAppBannerDelegate, LCAppModelDelegate { return } var appFound : LCAppModel? = nil - var isFoundAppHidden = false + var isFoundAppLocked = false for app in apps { if app.appInfo.relativeBundlePath == bundleId { appFound = app + if app.appInfo.isLocked { + isFoundAppLocked = true + } break } } @@ -494,13 +497,13 @@ struct LCAppListView : View, LCAppBannerDelegate, LCAppModelDelegate { for app in hiddenApps { if app.appInfo.relativeBundlePath == bundleId { appFound = app - isFoundAppHidden = true + isFoundAppLocked = true break } } } - if isFoundAppHidden && !sharedModel.isHiddenAppUnlocked { + if isFoundAppLocked && !sharedModel.isHiddenAppUnlocked { do { let result = try await LCUtils.authenticateUser() if !result { diff --git a/LiveContainerSwiftUI/LCAppModel.swift b/LiveContainerSwiftUI/LCAppModel.swift index e7a6091..838a0b3 100644 --- a/LiveContainerSwiftUI/LCAppModel.swift +++ b/LiveContainerSwiftUI/LCAppModel.swift @@ -30,6 +30,10 @@ class LCAppModel: ObservableObject, Hashable { init(appInfo : LCAppInfo, delegate: LCAppModelDelegate? = nil) { self.appInfo = appInfo self.delegate = delegate + + if !appInfo.isLocked && appInfo.isHidden { + appInfo.isLocked = true + } self.uiIsJITNeeded = appInfo.isJITNeeded self.uiIsHidden = appInfo.isHidden @@ -126,8 +130,20 @@ class LCAppModel: ObservableObject, Hashable { func toggleLock() async { if appInfo.isLocked { + do { + if !(try await LCUtils.authenticateUser()) { + return + } + } catch { + return + } + appInfo.isLocked = false uiIsLocked = false + + if appInfo.isHidden { + await toggleHidden() + } } else { appInfo.isLocked = true uiIsLocked = true From e5aec5b2b064e79bda41d015ad7521da6748a567 Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 13:17:51 +0900 Subject: [PATCH 14/16] final fix? --- LiveContainerSwiftUI/LCAppListView.swift | 2 +- LiveContainerSwiftUI/LCAppModel.swift | 8 -------- LiveContainerSwiftUI/LCAppSettingsView.swift | 11 ++++++++++- LiveContainerSwiftUI/LCWebView.swift | 4 ++-- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppListView.swift b/LiveContainerSwiftUI/LCAppListView.swift index b28a069..0136f55 100644 --- a/LiveContainerSwiftUI/LCAppListView.swift +++ b/LiveContainerSwiftUI/LCAppListView.swift @@ -295,7 +295,7 @@ struct LCAppListView : View, LCAppBannerDelegate, LCAppModelDelegate { return } - if appToLaunch.appInfo.isHidden && !sharedModel.isHiddenAppUnlocked { + if appToLaunch.appInfo.isLocked && !sharedModel.isHiddenAppUnlocked { do { if !(try await LCUtils.authenticateUser()) { return diff --git a/LiveContainerSwiftUI/LCAppModel.swift b/LiveContainerSwiftUI/LCAppModel.swift index 838a0b3..dbe4401 100644 --- a/LiveContainerSwiftUI/LCAppModel.swift +++ b/LiveContainerSwiftUI/LCAppModel.swift @@ -130,14 +130,6 @@ class LCAppModel: ObservableObject, Hashable { func toggleLock() async { if appInfo.isLocked { - do { - if !(try await LCUtils.authenticateUser()) { - return - } - } catch { - return - } - appInfo.isLocked = false uiIsLocked = false diff --git a/LiveContainerSwiftUI/LCAppSettingsView.swift b/LiveContainerSwiftUI/LCAppSettingsView.swift index 97fb00a..59cbad5 100644 --- a/LiveContainerSwiftUI/LCAppSettingsView.swift +++ b/LiveContainerSwiftUI/LCAppSettingsView.swift @@ -158,7 +158,16 @@ struct LCAppSettingsView : View{ Toggle(isOn: $model.uiIsLocked) { Text("lc.appSettings.lockApp".loc) } - .onChange(of: model.uiIsLocked, perform: { _ in + .onChange(of: model.uiIsLocked, perform: { newValue in + do { + let result = try await LCUtils.authenticateUser() + if !result { + model.uiIsLocked = !newValue + return + } + } catch { + return + } Task { await model.toggleLock() } }) diff --git a/LiveContainerSwiftUI/LCWebView.swift b/LiveContainerSwiftUI/LCWebView.swift index 85cb57c..09f5a18 100644 --- a/LiveContainerSwiftUI/LCWebView.swift +++ b/LiveContainerSwiftUI/LCWebView.swift @@ -169,7 +169,7 @@ struct LCWebView: View { return } - if appToLaunch.appInfo.isHidden && !sharedModel.isHiddenAppUnlocked { + if appToLaunch.appInfo.isLocked && !sharedModel.isHiddenAppUnlocked { do { if !(try await LCUtils.authenticateUser()) { @@ -214,7 +214,7 @@ struct LCWebView: View { return } - if appToLaunch.appInfo.isHidden && !sharedModel.isHiddenAppUnlocked { + if appToLaunch.appInfo.isLocked && !sharedModel.isHiddenAppUnlocked { do { if !(try await LCUtils.authenticateUser()) { return From b05020441b0d8d33fa698e18d45bf2bca32ba211 Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 13:23:32 +0900 Subject: [PATCH 15/16] a --- LiveContainerSwiftUI/LCAppSettingsView.swift | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppSettingsView.swift b/LiveContainerSwiftUI/LCAppSettingsView.swift index 59cbad5..e82cca3 100644 --- a/LiveContainerSwiftUI/LCAppSettingsView.swift +++ b/LiveContainerSwiftUI/LCAppSettingsView.swift @@ -159,16 +159,19 @@ struct LCAppSettingsView : View{ Text("lc.appSettings.lockApp".loc) } .onChange(of: model.uiIsLocked, perform: { newValue in - do { - let result = try await LCUtils.authenticateUser() - if !result { - model.uiIsLocked = !newValue + Task { + do { + let result = try await LCUtils.authenticateUser() + if !result { + model.uiIsLocked = !newValue + return + } + } catch { return } - } catch { - return + + await model.toggleLock() } - Task { await model.toggleLock() } }) if model.uiIsLocked { From 4c1fa49967f16f345d1af3b20432a22298db388c Mon Sep 17 00:00:00 2001 From: fkunn1326 <92153597+fkunn1326@users.noreply.github.com> Date: Mon, 23 Sep 2024 13:53:27 +0900 Subject: [PATCH 16/16] fix --- LiveContainerSwiftUI/LCAppBanner.swift | 14 +++++++++++++- LiveContainerSwiftUI/LCAppSettingsView.swift | 14 ++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/LiveContainerSwiftUI/LCAppBanner.swift b/LiveContainerSwiftUI/LCAppBanner.swift index beca3d7..3380add 100644 --- a/LiveContainerSwiftUI/LCAppBanner.swift +++ b/LiveContainerSwiftUI/LCAppBanner.swift @@ -71,7 +71,7 @@ struct LCAppBanner : View { Capsule().fill(Color("JITBadgeColor")) ) } - if model.uiIsLocked { + if model.uiIsLocked && !model.uiIsHidden { Text("lc.appBanner.locked".loc).font(.system(size: 8)).bold().padding(2) .frame(width: 50, height:16) .background( @@ -246,6 +246,18 @@ struct LCAppBanner : View { } func runApp() async { + if appInfo.isLocked && !sharedModel.isHiddenAppUnlocked { + do { + if !(try await LCUtils.authenticateUser()) { + return + } + } catch { + errorInfo = error.localizedDescription + errorShow = true + return + } + } + do { try await model.runApp() } catch { diff --git a/LiveContainerSwiftUI/LCAppSettingsView.swift b/LiveContainerSwiftUI/LCAppSettingsView.swift index e82cca3..42adc93 100644 --- a/LiveContainerSwiftUI/LCAppSettingsView.swift +++ b/LiveContainerSwiftUI/LCAppSettingsView.swift @@ -160,14 +160,16 @@ struct LCAppSettingsView : View{ } .onChange(of: model.uiIsLocked, perform: { newValue in Task { - do { - let result = try await LCUtils.authenticateUser() - if !result { - model.uiIsLocked = !newValue + if !newValue { + do { + let result = try await LCUtils.authenticateUser() + if !result { + model.uiIsLocked = true + return + } + } catch { return } - } catch { - return } await model.toggleLock()