diff --git a/CustomNotification/Info.plist b/CustomNotification/Info.plist
index dd116a6..8967426 100644
--- a/CustomNotification/Info.plist
+++ b/CustomNotification/Info.plist
@@ -19,7 +19,7 @@
CFBundleShortVersionString
$(MARKETING_VERSION)
CFBundleVersion
- 408
+ 424
DASHBOARD_URL
$(DASHBOARD_URL)
NSExtension
diff --git a/NotificationService/Info.plist b/NotificationService/Info.plist
index 3506851..5c69ac7 100644
--- a/NotificationService/Info.plist
+++ b/NotificationService/Info.plist
@@ -19,7 +19,7 @@
CFBundleShortVersionString
$(MARKETING_VERSION)
CFBundleVersion
- 408
+ 424
NSExtension
NSExtensionPointIdentifier
diff --git a/Shared/EndPoint.swift b/Shared/EndPoint.swift
index 31c9c24..f76570a 100644
--- a/Shared/EndPoint.swift
+++ b/Shared/EndPoint.swift
@@ -9,7 +9,7 @@ enum Endpoint: String {
case sensor = "/participant/%@/sensor"
case getParticipant = "/participant/me"
case activity = "/participant/%@/activity?ignore_binary=true"
- case activityEvent = "/participant/%@/activity_event"
+ case activityEvent = "/participant/%@/activity_event"//?ignore_binary=true
case getLatestDashboard = "/version/get"
diff --git a/StreakWidget/StreakWidget.swift b/StreakWidget/StreakWidget.swift
index e4e7d16..3067f2b 100644
--- a/StreakWidget/StreakWidget.swift
+++ b/StreakWidget/StreakWidget.swift
@@ -23,18 +23,24 @@ struct Provider: TimelineProvider {
func getTimeline(in context: Context, completion: @escaping (Timeline) -> ()) {
helper.fetchActivityEvents(participantId: UserDefaults.standard.participantIdShared) { dates in
- guard let dates else {
- return
- }
- let reslut = (UserDefaults.standard.streakDataCurrentShared, UserDefaults.standard.streakDataMaxShared)
-
- let entry = SimpleEntry(date: Date(), currentStreak: reslut.0, longestStreak: reslut.1)
//Next fetch happens 15 minutes later
let nextUpdate = Calendar.current.date(
byAdding: DateComponents(hour: 4),
to: Date()
)!
+ guard dates != nil else {
+ let entry = SimpleEntry(date: Date(), currentStreak: 0, longestStreak: 0)
+ let timeline = Timeline(
+ entries: [entry],
+ policy: .after(nextUpdate)
+ )
+ completion(timeline)
+ return
+ }
+ let reslut = (UserDefaults.standard.streakDataCurrentShared, UserDefaults.standard.streakDataMaxShared)
+
+ let entry = SimpleEntry(date: Date(), currentStreak: reslut.0, longestStreak: reslut.1)
let timeline = Timeline(
entries: [entry],
@@ -54,28 +60,56 @@ struct SimpleEntry: TimelineEntry {
struct StreakWidgetEntryView : View {
var entry: Provider.Entry
+ @SwiftUI.Environment(\.widgetFamily) var family
+ @ViewBuilder
var body: some View {
- VStack(alignment: .center, spacing: 5) {
-
- Image("logo")
- .resizable()
- .aspectRatio(contentMode: .fit)
- .frame(width: 40)
-
- let daysText1: String = entry.currentStreak == 1 ? "day" : "days"
- Text("Current streak: \(entry.currentStreak) \(daysText1)")
- .font(.system(size: 12))
- .fontWeight(.black)
-
- let daysText: String = entry.longestStreak == 1 ? "day" : "days"
- Text("Longest Streak: \(entry.longestStreak) \(daysText)")
- .font(.system(size: 12))
- .fontWeight(.black)
-
- Text("Way To Go!")
- .font(.system(size: 14))
- .fontWeight(.bold)
+
+ switch family {
+ case .systemSmall:
+ VStack(alignment: .center, spacing: 5) {
+
+ Image("logo")
+ .resizable()
+ .aspectRatio(contentMode: .fit)
+ .frame(width: 36)
+
+ let daysText1: String = entry.currentStreak == 1 ? "day" : "days"
+ Text("Current streak: \(entry.currentStreak) \(daysText1)")
+ .font(.system(size: 10))
+ .fontWeight(.medium)
+
+ let daysText: String = entry.longestStreak == 1 ? "day" : "days"
+ Text("Longest Streak: \(entry.longestStreak) \(daysText)")
+ .font(.system(size: 10))
+ .fontWeight(.medium)
+
+ Text("Way To Go!")
+ .font(.system(size: 11))
+ .fontWeight(.medium)
+ }
+ default:
+ VStack(alignment: .center, spacing: 5) {
+
+ Image("logo")
+ .resizable()
+ .aspectRatio(contentMode: .fit)
+ .frame(width: 40)
+
+ let daysText1: String = entry.currentStreak == 1 ? "day" : "days"
+ Text("Current streak: \(entry.currentStreak) \(daysText1)")
+ .font(.system(size: 14))
+ .fontWeight(.medium)
+
+ let daysText: String = entry.longestStreak == 1 ? "day" : "days"
+ Text("Longest Streak: \(entry.longestStreak) \(daysText)")
+ .font(.system(size: 14))
+ .fontWeight(.medium)
+
+ Text("Way To Go!")
+ .font(.system(size: 15))
+ .fontWeight(.medium)
+ }
}
}
}
diff --git a/StreakWidgetHelper/StreakWidgetHelper.swift b/StreakWidgetHelper/StreakWidgetHelper.swift
index c8790df..bbd9835 100644
--- a/StreakWidgetHelper/StreakWidgetHelper.swift
+++ b/StreakWidgetHelper/StreakWidgetHelper.swift
@@ -22,35 +22,54 @@ public class StreakWidgetHelper {
}
}
static var cachedEntry:(Int, Int) = (0, 0)
+
+ func longestStreakFor(participantId: String) -> Int {
+ let dict: [String: Int]? = UserDefaults.standard.object(forKey: "longestActivityStreak") as? [String: Int]
+ return dict?[participantId] ?? 0
+ }
+
+ func setLongestStreak(streak: Int, participantId: String) {
+ let dict: [String: Int] = [participantId: streak]
+ UserDefaults.standard.setValue(dict, forKey: "longestActivityStreak")
+ }
+
public func fetchActivityEvents(participantId: String?, completion: (([Date]?) -> Void)?) {
guard let participantId else {
completion?(nil)
return
}
- //todo execute once per day
-
- //update server
- let task = URLSession.shared.dataTask(with: urlRequest(participantId: participantId)) { [weak self] data, response, error in
-
+ let fromDate: Date
+ if longestStreakFor(participantId: participantId) <= 0 {
+ fromDate = Calendar.current.date(byAdding: .year, value: -1, to: Date())!
+ } else {
+ fromDate = Calendar.current.date(byAdding: .month, value: -3, to: Date())!
+ }
+
+ let task = URLSession.shared.dataTask(with: urlRequest(participantId: participantId, fromDate: fromDate)) { [weak self] data, response, error in
+
if let data, let urlResponse = response as? HTTPURLResponse {
+
+
let decoder = JSONDecoder()
let formatter = ISO8601DateFormatter()
decoder.dateDecodingStrategy = .formatted(formatter)
do {
let responseData = try decoder.decode(ActivityEventResponse.self, from: data)
-
let reslut = self?.findCurentAndLongestStreak(dates: responseData.dates ?? [])
+
+
UserDefaults.standard.streakDataCurrentShared = reslut?.0 ?? 0
UserDefaults.standard.streakDataMaxShared = reslut?.1 ?? 0
+
+ self?.setLongestStreak(streak: reslut?.1 ?? 0, participantId: participantId)
if let reslut {
StreakWidgetHelper.cachedEntry = reslut
}
completion?(responseData.dates)
-
} catch (let err) {
completion?(nil)
}
@@ -87,12 +106,21 @@ public class StreakWidgetHelper {
// }
}
- func urlRequest(participantId: String) -> URLRequest {
-
+ func urlRequest(participantId: String, fromDate: Date) -> URLRequest {
+ //from to timestamp
let endPoint = String(format: Endpoint.activityEvent.rawValue, participantId)
-
let baseURL = URL(string: LampURL.baseURLString)!
- var request = URLRequest(url: baseURL.appendingPathComponent(endPoint))
+ let fullurl = baseURL.appendingPathComponent(endPoint)
+ //https://api-staging.lamp.digital/participant/U2604494105/activity_event?from=1719945000516&to=1720031400516
+ var components = URLComponents(string: fullurl.absoluteString)!
+
+ components.queryItems = [
+ URLQueryItem(name: "from", value: String(fromDate.timeInMilliSeconds)),
+ //URLQueryItem(name: "to", value: String(Date().timeInMilliSeconds)),
+ ]
+ let url = components.url!
+
+ var request = URLRequest(url: url)
request.httpMethod = "GET"
var requestHeaders = [String: String]()
requestHeaders["Content-Type"] = "application/json"
@@ -123,14 +151,12 @@ public class StreakWidgetHelper {
var uniqueDaysArray = [Date]()
let dateFormatter = DateFormatter()
- dateFormatter.timeZone = .current
+ dateFormatter.timeZone = TimeZone(secondsFromGMT: 0)
dateFormatter.locale = Locale(identifier: "en_US_POSIX")
dateFormatter.dateFormat = "yyyy-MM-dd"
for date in dates {
- print("date = \(date)")
let dayString = dateFormatter.string(from: date)
- print("dayString = \(dayString)")
if !uniqueDaysSet.contains(dayString) {
uniqueDaysSet.insert(dayString)
uniqueDaysArray.append(dateFormatter.date(from: dayString)!)
diff --git a/mindLAMP.xcodeproj/project.pbxproj b/mindLAMP.xcodeproj/project.pbxproj
index 2b3691f..aa023aa 100644
--- a/mindLAMP.xcodeproj/project.pbxproj
+++ b/mindLAMP.xcodeproj/project.pbxproj
@@ -1671,7 +1671,7 @@
CODE_SIGN_ENTITLEMENTS = mindLAMP/mindLAMP.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 412;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_ASSET_PATHS = "\"mindLAMP/Preview Content\"";
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = S2Y2D4239K;
@@ -1684,7 +1684,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp;
@@ -1712,7 +1712,7 @@
CODE_SIGN_ENTITLEMENTS = CustomNotification/CustomNotification.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 408;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = S2Y2D4239K;
INFOPLIST_FILE = CustomNotification/Info.plist;
@@ -1722,7 +1722,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp.CustomNotification;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "mindLAMP2 Custom Notification Extension";
@@ -1745,7 +1745,7 @@
CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 408;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = S2Y2D4239K;
INFOPLIST_FILE = NotificationService/Info.plist;
@@ -1755,7 +1755,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp.NotificationService;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "mindLAMP2 Notification Service";
@@ -1781,7 +1781,7 @@
CODE_SIGN_ENTITLEMENTS = "watchkitapp Extension/watchkitapp Extension.entitlements";
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 412;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=watchos*]" = S2Y2D4239K;
INFOPLIST_FILE = watchkitapp/Info.plist;
@@ -1789,7 +1789,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp.wearable;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "mindLAMP WatchApp Dev";
@@ -1872,7 +1872,7 @@
CODE_SIGN_ENTITLEMENTS = mindLAMP/mindLAMP.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 412;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_ASSET_PATHS = "\"mindLAMP/Preview Content\"";
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = S2Y2D4239K;
@@ -1885,7 +1885,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp;
@@ -1912,7 +1912,7 @@
CODE_SIGN_ENTITLEMENTS = CustomNotification/CustomNotification.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 408;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = S2Y2D4239K;
INFOPLIST_FILE = CustomNotification/Info.plist;
@@ -1922,7 +1922,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp.CustomNotification;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "mindLAMP2 Custom Notification Extension";
@@ -1945,7 +1945,7 @@
CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 408;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = S2Y2D4239K;
INFOPLIST_FILE = NotificationService/Info.plist;
@@ -1955,7 +1955,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp.NotificationService;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "mindLAMP2 Notification Service";
@@ -1981,7 +1981,7 @@
CODE_SIGN_ENTITLEMENTS = "watchkitapp Extension/watchkitapp Extension.entitlements";
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 412;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=watchos*]" = S2Y2D4239K;
INFOPLIST_FILE = watchkitapp/Info.plist;
@@ -1989,7 +1989,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp.wearable;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "mindLAMP WatchApp Dev";
@@ -2283,7 +2283,7 @@
CODE_SIGN_ENTITLEMENTS = "watchkitapp Extension/watchkitapp Extension.entitlements";
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 412;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=watchos*]" = S2Y2D4239K;
INFOPLIST_FILE = watchkitapp/Info.plist;
@@ -2291,7 +2291,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp.wearable;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "mindLAMP WatchApp Dev";
@@ -2315,7 +2315,7 @@
CODE_SIGN_ENTITLEMENTS = "watchkitapp Extension/watchkitapp Extension.entitlements";
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 412;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=watchos*]" = S2Y2D4239K;
INFOPLIST_FILE = watchkitapp/Info.plist;
@@ -2323,7 +2323,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp.wearable;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "mindLAMP WatchApp Dev";
@@ -2344,7 +2344,7 @@
CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 408;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = S2Y2D4239K;
INFOPLIST_FILE = NotificationService/Info.plist;
@@ -2354,7 +2354,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp.NotificationService;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "mindLAMP2 Notification Service";
@@ -2377,7 +2377,7 @@
CODE_SIGN_ENTITLEMENTS = NotificationService/NotificationService.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 408;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = S2Y2D4239K;
INFOPLIST_FILE = NotificationService/Info.plist;
@@ -2387,7 +2387,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp.NotificationService;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "mindLAMP2 Notification Service";
@@ -2537,7 +2537,7 @@
CODE_SIGN_ENTITLEMENTS = mindLAMP/mindLAMP.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 412;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_ASSET_PATHS = "\"mindLAMP/Preview Content\"";
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = S2Y2D4239K;
@@ -2550,7 +2550,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp;
@@ -2581,7 +2581,7 @@
CODE_SIGN_ENTITLEMENTS = mindLAMP/mindLAMP.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 412;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_ASSET_PATHS = "\"mindLAMP/Preview Content\"";
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = S2Y2D4239K;
@@ -2594,7 +2594,7 @@
"$(inherited)",
"@executable_path/Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp;
@@ -2621,7 +2621,7 @@
CODE_SIGN_ENTITLEMENTS = CustomNotification/CustomNotification.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 408;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = S2Y2D4239K;
INFOPLIST_FILE = CustomNotification/Info.plist;
@@ -2631,7 +2631,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp.CustomNotification;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "mindLAMP2 Custom Notification Extension";
@@ -2654,7 +2654,7 @@
CODE_SIGN_ENTITLEMENTS = CustomNotification/CustomNotification.entitlements;
CODE_SIGN_IDENTITY = "iPhone Distribution";
CODE_SIGN_STYLE = Manual;
- CURRENT_PROJECT_VERSION = 408;
+ CURRENT_PROJECT_VERSION = 424;
DEVELOPMENT_TEAM = S2Y2D4239K;
"DEVELOPMENT_TEAM[sdk=iphoneos*]" = S2Y2D4239K;
INFOPLIST_FILE = CustomNotification/Info.plist;
@@ -2664,7 +2664,7 @@
"@executable_path/Frameworks",
"@executable_path/../../Frameworks",
);
- MARKETING_VERSION = 2023.8.25;
+ MARKETING_VERSION = 2024.6.15;
PRODUCT_BUNDLE_IDENTIFIER = digital.lamp.mindlamp.CustomNotification;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "mindLAMP2 Custom Notification Extension";
@@ -2768,7 +2768,7 @@
repositoryURL = "https://github.com/BIDMCDigitalPsychiatry/LAMP-swift.git";
requirement = {
kind = exactVersion;
- version = 2023.12.19;
+ version = 2024.7.23;
};
};
/* End XCRemoteSwiftPackageReference section */
diff --git a/mindLAMP.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved b/mindLAMP.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
index 725bc52..b1a7150 100644
--- a/mindLAMP.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
+++ b/mindLAMP.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved
@@ -6,10 +6,10 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/BIDMCDigitalPsychiatry/LAMP-swift.git",
"state" : {
- "revision" : "10ba053cd95a10d8a5cd11a8f031b8bc77b89b90",
- "version" : "2023.12.19"
+ "revision" : "0123c1599e4216ab3d58ed2b7e86566fbfd2db42",
+ "version" : "2024.7.23"
}
}
],
- "version" : 2
+ "version" : 3
}
diff --git a/mindLAMP.xcodeproj/xcshareddata/xcschemes/mindLAMP (Staging).xcscheme b/mindLAMP.xcodeproj/xcshareddata/xcschemes/mindLAMP (Staging).xcscheme
index 9499b48..2bbd3ad 100644
--- a/mindLAMP.xcodeproj/xcshareddata/xcschemes/mindLAMP (Staging).xcscheme
+++ b/mindLAMP.xcodeproj/xcshareddata/xcschemes/mindLAMP (Staging).xcscheme
@@ -42,9 +42,10 @@
+
+
+
+
+
+
diff --git a/mindLAMP/AppDelegate.swift b/mindLAMP/AppDelegate.swift
index 7d3f2f5..8db2529 100755
--- a/mindLAMP/AppDelegate.swift
+++ b/mindLAMP/AppDelegate.swift
@@ -41,7 +41,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
let homeVC = HomeViewController()
self.window?.rootViewController = UINavigationController(rootViewController: homeVC)
self.window?.makeKeyAndVisible()
-
+
return true
}
@@ -65,6 +65,20 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
WidgetCenter.shared.reloadAllTimelines()
}
}
+
+ func application(_ application: UIApplication, willContinueUserActivityWithType userActivityType: String) -> Bool {
+
+ if userActivityType == "StreakWidget" {
+ if let navController = self.window?.rootViewController as? UINavigationController {
+
+ if let existiWebController = navController.topViewController as? HomeViewController {
+ existiWebController.tappedWidget()
+ return true
+ }
+ }
+ }
+ return true
+ }
}
private extension AppDelegate {
diff --git a/mindLAMP/Home/HomeViewController.swift b/mindLAMP/Home/HomeViewController.swift
index 9a39fea..710672a 100644
--- a/mindLAMP/Home/HomeViewController.swift
+++ b/mindLAMP/Home/HomeViewController.swift
@@ -18,6 +18,8 @@ class HomeViewController: UIViewController {
private lazy var lampAPI: NetworkingAPI = {
return NetworkConfig.networkingAPI()
}()
+
+ var feedURLToLoad: URL?
//var loginSubscriber: AnyCancellable?
//var isHomePageLoaded = false
//@IBOutlet weak var containerView: UIView!
@@ -51,7 +53,31 @@ class HomeViewController: UIViewController {
}
}
+
+ func tappedWidget() {
+
+ guard let participantId = User.shared.userId else {
+ return
+ }
+ let urlstring = String(format: "https://dashboard-staging.lamp.digital/#/participant/%@/feed", participantId)
+
+ guard isWebpageLoaded == true else {
+ feedURLToLoad = URL(string: urlstring)
+ return
+ }
+ wkWebView.evaluateJavaScript("window.location.href='\(urlstring)';") { obbj ,error in
+ self.wkWebView.evaluateJavaScript("window.location.reload()")
+ }
+// guard let pageURL = URL(string: urlstring) else {return}
+// wkWebView.endEditing(true)
+// indicator.startAnimating()
+// view.bringSubviewToFront(indicator)
+// DispatchQueue.main.async {
+// self.wkWebView.load(URLRequest(url: pageURL))
+// }
+ }
+
override func loadView() {
super.loadView()
self.loadWebView()
@@ -172,7 +198,12 @@ private extension HomeViewController {
func loadWebPage() {
if User.shared.isLogin() == true {
- wkWebView.load(URLRequest(url: self.lampDashboardURLwithToken))
+ if let feedURL = feedURLToLoad {
+ wkWebView.load(URLRequest(url: feedURL))
+ feedURLToLoad = nil
+ } else {
+ wkWebView.load(URLRequest(url: self.lampDashboardURLwithToken))
+ }
} else {
wkWebView.load(URLRequest(url: LampURL.dashboardDigital))
}
diff --git a/mindLAMP/Info.plist b/mindLAMP/Info.plist
index fcc0c5c..12c0d4d 100755
--- a/mindLAMP/Info.plist
+++ b/mindLAMP/Info.plist
@@ -34,9 +34,22 @@
CFBundlePackageType
$(PRODUCT_BUNDLE_PACKAGE_TYPE)
CFBundleShortVersionString
- 2023.8.25
+ 2024.6.15
+ CFBundleURLTypes
+
+
+ CFBundleTypeRole
+ Editor
+ CFBundleURLName
+ digital.lamp.mindlamp
+ CFBundleURLSchemes
+
+ widget-deeplink
+
+
+
CFBundleVersion
- 412
+ 424
DASHBOARD_URL
$(DASHBOARD_URL)
ITSAppUsesNonExemptEncryption