-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
370 changed files
with
10,149 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
name: "\U0001F430 issue template" | ||
about: zoe의 새로운 이슈 추가 | ||
title: "[Feat]" | ||
labels: "\U0001F430지희" | ||
assignees: Zoe0929 | ||
|
||
--- | ||
|
||
## 💡 About | ||
<!--무엇에 관한 이슈인지 소개해주세요.--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
name: "✈️ issue template" | ||
about: 의 새로운 이슈 추가 | ||
title: "[Feat]" | ||
labels: "😎선우" | ||
assignees: kim-seonwoo | ||
|
||
--- | ||
|
||
## 💡 About | ||
<!--무엇에 관한 이슈인지 소개해주세요.--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
name: "🙊 issue template" | ||
about: 보연의 새로운 이슈 추가 | ||
title: "[Feat]" | ||
labels: "🙊보연" | ||
assignees: boyeon0119 | ||
|
||
--- | ||
|
||
## 💡 About | ||
<!--무엇에 관한 이슈인지 소개해주세요.--> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# Set to true to add reviewers to pull requests | ||
addReviewers: true | ||
|
||
# Set to true to add assignees to pull requests | ||
addAssignees: author | ||
|
||
# A list of reviewers to be added to pull requests (GitHub user name) | ||
reviewers: | ||
- Zoe0929 | ||
- kim-seonwoo | ||
|
||
# A number of reviewers added to the pull request | ||
# Set 0 to add all the reviewers (default: 0) | ||
numberOfReviewers: 2 | ||
|
||
|
||
# A number of assignees to add to the pull request | ||
# Set to 0 to add all of the assignees. | ||
# Uses numberOfReviewers if unset. | ||
numberOfAssignees: 1 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
HMH_iOS/DeviceActivityMonitor/DeviceActivityMonitor.entitlements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>com.apple.developer.family-controls</key> | ||
<true/> | ||
<key>com.apple.security.application-groups</key> | ||
<array> | ||
<string>group.HMH</string> | ||
</array> | ||
</dict> | ||
</plist> |
103 changes: 103 additions & 0 deletions
103
HMH_iOS/DeviceActivityMonitor/DeviceActivityMonitorExtension.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
// | ||
// DeviceActivityMonitorExtension.swift | ||
// DeviceMonitor | ||
// | ||
// Created by 지희의 MAC on 1/4/24. | ||
// | ||
// | ||
|
||
import DeviceActivity | ||
import ManagedSettings | ||
import Foundation | ||
import UserNotifications | ||
|
||
import SwiftUI | ||
import FamilyControls | ||
|
||
// Optionally override any of the functions below. | ||
// Make sure that your class name matches the NSExtensionPrincipalClass in your Info.plist. | ||
class DeviceActivityMonitorExtension: DeviceActivityMonitor { | ||
|
||
@AppStorage(AppStorageKey.selectionApp.rawValue, store: UserDefaults(suiteName: APP_GROUP_NAME)) | ||
var selectionApps = FamilyActivitySelection() | ||
|
||
@StateObject var screenTimeVM = ScreenTimeViewModel() | ||
|
||
let store = ManagedSettingsStore() | ||
let userNotiCenter = UNUserNotificationCenter.current() | ||
|
||
override func intervalDidStart(for activity: DeviceActivityName) { | ||
super.intervalDidStart(for: activity) | ||
} | ||
|
||
override func intervalDidEnd(for activity: DeviceActivityName) { | ||
super.intervalDidEnd(for: activity) | ||
store.shield.applications = nil | ||
} | ||
|
||
//threshold에 도착하면 행동한다 | ||
override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) { | ||
store.shield.applications = selectionApps.applicationTokens // 이러면 다른 앱도 잠김 | ||
Task { | ||
await screenTimeVM.handleSetBlockApplication() | ||
} | ||
let notiContent = UNMutableNotificationContent() | ||
notiContent.title = "하면함" | ||
notiContent.body = "이용 시간이 종료 되었습니다." | ||
notiContent.userInfo = ["token": ""] // 푸시 받을때 오는 데이터 | ||
|
||
// 알림이 trigger되는 시간 설정 | ||
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false) | ||
|
||
let request = UNNotificationRequest( | ||
identifier: UUID().uuidString, | ||
content: notiContent, | ||
trigger: trigger | ||
) | ||
|
||
self.userNotiCenter.add(request) { (error) in | ||
print(#function, error as Any) | ||
} | ||
|
||
} | ||
|
||
override func intervalWillStartWarning(for activity: DeviceActivityName) { | ||
super.intervalWillStartWarning(for: activity) | ||
|
||
// Handle the warning before the interval starts. | ||
} | ||
|
||
override func intervalWillEndWarning(for activity: DeviceActivityName) { | ||
super.intervalWillEndWarning(for: activity) | ||
//NotificationManager.shared.scheduleNotification() | ||
|
||
// Handle the warning before the interval ends. | ||
|
||
} | ||
|
||
//threshold 시간이 되면 경고를 준다 | ||
override func eventWillReachThresholdWarning(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) { | ||
super.eventWillReachThresholdWarning(event, activity: activity) | ||
//store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.all() | ||
let notiContent = UNMutableNotificationContent() | ||
notiContent.title = "하면함" | ||
notiContent.body = "이용 시간이 종료되었습니다. 곧 어플이 잠깁니다." | ||
notiContent.userInfo = ["status": ""] // 푸시 받을때 오는 데이터 | ||
|
||
// 알림이 trigger되는 시간 설정 | ||
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false) | ||
|
||
let request = UNNotificationRequest( | ||
identifier: UUID().uuidString, | ||
content: notiContent, | ||
trigger: trigger | ||
) | ||
|
||
userNotiCenter.add(request) { (error) in | ||
print(#function, error as Any) | ||
} | ||
|
||
//NotificationManager.shared.scheduleNotification() | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>NSExtension</key> | ||
<dict> | ||
<key>NSExtensionPointIdentifier</key> | ||
<string>com.apple.deviceactivity.monitor-extension</string> | ||
<key>NSExtensionPrincipalClass</key> | ||
<string>$(PRODUCT_MODULE_NAME).DeviceActivityMonitorExtension</string> | ||
</dict> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>BASE_URL</key> | ||
<string>$(BASE_URL)</string> | ||
<key>BGTaskSchedulerPermittedIdentifiers</key> | ||
<array> | ||
<string>com.HMH.dailyTask</string> | ||
</array> | ||
<key>CFBundleURLTypes</key> | ||
<array> | ||
<dict> | ||
<key>CFBundleTypeRole</key> | ||
<string>Editor</string> | ||
<key>CFBundleURLSchemes</key> | ||
<array> | ||
<string>kakao$(KAKAO_API_KEY)</string> | ||
</array> | ||
</dict> | ||
</array> | ||
<key>KAKAO_API_KEY</key> | ||
<string>$(KAKAO_API_KEY)</string> | ||
<key>LSApplicationQueriesSchemes</key> | ||
<array> | ||
<string>kakaokompassauth</string> | ||
<string>kakaolink</string> | ||
</array> | ||
<key>NSAppTransportSecurity</key> | ||
<dict> | ||
<key>NSAllowsArbitraryLoads</key> | ||
<true/> | ||
</dict> | ||
<key>UIAppFonts</key> | ||
<array> | ||
<string>Pretendard-Regular.otf</string> | ||
<string>Pretendard-SemiBold.otf</string> | ||
<string>Pretendard-Medium.otf</string> | ||
</array> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// | ||
// ActivityModel.swift | ||
// HMHDeviceActivityReport | ||
// | ||
// Created by 이지희 on 5/12/24. | ||
// | ||
|
||
import Foundation | ||
|
||
import ManagedSettings | ||
|
||
struct ActivityReport { | ||
let totalDuration: Int | ||
let titleState: [String] | ||
var remainTime: Int | ||
var totalGoalTime: Int | ||
let apps: [AppDeviceActivity] | ||
} | ||
|
||
struct ChallengeActivity { | ||
let totalDuration: TimeInterval | ||
let apps: [AppDeviceActivity] | ||
} | ||
|
||
struct AppDeviceActivity: Identifiable { | ||
var id: String | ||
var displayName: String | ||
var duration: TimeInterval | ||
var remainTime: TimeInterval | ||
var numberOfPickups: Int | ||
var token: ApplicationToken? | ||
} | ||
|
||
struct TotalActivityModel: Identifiable { | ||
var id: String | ||
var totalTime: Int | ||
var remainTime: Int | ||
var totalGoalTime: Int | ||
var titleState: [String] | ||
} | ||
|
||
extension TimeInterval { | ||
/// TimeInterval 타입 값을 00:00 형식의 String으로 변환해주는 메서드 | ||
func toString() -> String { | ||
let time = NSInteger(self) | ||
let minutes = (time / 60) % 60 | ||
let hours = (time / 3600) | ||
if hours < 1{ | ||
return String(format: "%d분", minutes) | ||
} else { | ||
return String(format: "%d시간 %d분", hours, minutes) | ||
} | ||
} | ||
} |
Oops, something went wrong.