Skip to content

Commit b84645c

Browse files
committed
Merge branch 'develop'
2 parents bebb929 + df46b06 commit b84645c

370 files changed

Lines changed: 10149 additions & 62 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: "\U0001F430 issue template"
3+
about: zoe의 새로운 이슈 추가
4+
title: "[Feat]"
5+
labels: "\U0001F430지희"
6+
assignees: Zoe0929
7+
8+
---
9+
10+
## 💡 About
11+
<!--무엇에 관한 이슈인지 소개해주세요.-->
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: "✈️ issue template"
3+
about: 의 새로운 이슈 추가
4+
title: "[Feat]"
5+
labels: "😎선우"
6+
assignees: kim-seonwoo
7+
8+
---
9+
10+
## 💡 About
11+
<!--무엇에 관한 이슈인지 소개해주세요.-->
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
name: "🙊 issue template"
3+
about: 보연의 새로운 이슈 추가
4+
title: "[Feat]"
5+
labels: "🙊보연"
6+
assignees: boyeon0119
7+
8+
---
9+
10+
## 💡 About
11+
<!--무엇에 관한 이슈인지 소개해주세요.-->

.github/auto_assign.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Set to true to add reviewers to pull requests
2+
addReviewers: true
3+
4+
# Set to true to add assignees to pull requests
5+
addAssignees: author
6+
7+
# A list of reviewers to be added to pull requests (GitHub user name)
8+
reviewers:
9+
- Zoe0929
10+
- kim-seonwoo
11+
12+
# A number of reviewers added to the pull request
13+
# Set 0 to add all the reviewers (default: 0)
14+
numberOfReviewers: 2
15+
16+
17+
# A number of assignees to add to the pull request
18+
# Set to 0 to add all of the assignees.
19+
# Uses numberOfReviewers if unset.
20+
numberOfAssignees: 1
21+

.gitignore

Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,42 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/macos,swift,swiftpackagemanager
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,swift,swiftpackagemanager
3+
4+
*.xcconfig
5+
6+
### macOS ###
7+
# General
8+
.DS_Store
9+
.AppleDouble
10+
.LSOverride
11+
12+
# Icon must end with two \r
13+
Icon
14+
15+
16+
# Thumbnails
17+
._*
18+
19+
# Files that might appear in the root of a volume
20+
.DocumentRevisions-V100
21+
.fseventsd
22+
.Spotlight-V100
23+
.TemporaryItems
24+
.Trashes
25+
.VolumeIcon.icns
26+
.com.apple.timemachine.donotpresent
27+
28+
# Directories potentially created on remote AFP share
29+
.AppleDB
30+
.AppleDesktop
31+
Network Trash Folder
32+
Temporary Items
33+
.apdisk
34+
35+
### macOS Patch ###
36+
# iCloud generated files
37+
*.icloud
38+
39+
### Swift ###
140
# Xcode
241
#
342
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
@@ -35,32 +74,26 @@ timeline.xctimeline
3574
playground.xcworkspace
3675

3776
# Swift Package Manager
38-
#
3977
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
4078
# Packages/
4179
# Package.pins
4280
# Package.resolved
4381
# *.xcodeproj
44-
#
4582
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
4683
# hence it is not needed unless you have added a package configuration file to your project
4784
# .swiftpm
4885

4986
.build/
5087

5188
# CocoaPods
52-
#
5389
# We recommend against adding the Pods directory to your .gitignore. However
5490
# you should judge for yourself, the pros and cons are mentioned at:
5591
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
56-
#
5792
# Pods/
58-
#
5993
# Add this line if you want to avoid checking in source code from the Xcode workspace
6094
# *.xcworkspace
6195

6296
# Carthage
63-
#
6497
# Add this line if you want to avoid checking in source code from Carthage dependencies.
6598
# Carthage/Checkouts
6699

@@ -71,7 +104,6 @@ Dependencies/
71104
.accio/
72105

73106
# fastlane
74-
#
75107
# It is recommended to not store the screenshots in the git repo.
76108
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
77109
# For more information about the recommended setup visit:
@@ -83,8 +115,15 @@ fastlane/screenshots/**/*.png
83115
fastlane/test_output
84116

85117
# Code Injection
86-
#
87118
# After new code Injection tools there's a generated folder /iOSInjectionProject
88119
# https://github.com/johnno1962/injectionforxcode
89120

90121
iOSInjectionProject/
122+
123+
### SwiftPackageManager ###
124+
Packages
125+
xcuserdata
126+
*.xcodeproj
127+
128+
129+
# End of https://www.toptal.com/developers/gitignore/api/macos,swift,swiftpackagemanager
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.developer.family-controls</key>
6+
<true/>
7+
<key>com.apple.security.application-groups</key>
8+
<array>
9+
<string>group.HMH</string>
10+
</array>
11+
</dict>
12+
</plist>
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
//
2+
// DeviceActivityMonitorExtension.swift
3+
// DeviceMonitor
4+
//
5+
// Created by 지희의 MAC on 1/4/24.
6+
//
7+
//
8+
9+
import DeviceActivity
10+
import ManagedSettings
11+
import Foundation
12+
import UserNotifications
13+
14+
import SwiftUI
15+
import FamilyControls
16+
17+
// Optionally override any of the functions below.
18+
// Make sure that your class name matches the NSExtensionPrincipalClass in your Info.plist.
19+
class DeviceActivityMonitorExtension: DeviceActivityMonitor {
20+
21+
@AppStorage(AppStorageKey.selectionApp.rawValue, store: UserDefaults(suiteName: APP_GROUP_NAME))
22+
var selectionApps = FamilyActivitySelection()
23+
24+
@StateObject var screenTimeVM = ScreenTimeViewModel()
25+
26+
let store = ManagedSettingsStore()
27+
let userNotiCenter = UNUserNotificationCenter.current()
28+
29+
override func intervalDidStart(for activity: DeviceActivityName) {
30+
super.intervalDidStart(for: activity)
31+
}
32+
33+
override func intervalDidEnd(for activity: DeviceActivityName) {
34+
super.intervalDidEnd(for: activity)
35+
store.shield.applications = nil
36+
}
37+
38+
//threshold에 도착하면 행동한다
39+
override func eventDidReachThreshold(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) {
40+
store.shield.applications = selectionApps.applicationTokens // 이러면 다른 앱도 잠김
41+
Task {
42+
await screenTimeVM.handleSetBlockApplication()
43+
}
44+
let notiContent = UNMutableNotificationContent()
45+
notiContent.title = "하면함"
46+
notiContent.body = "이용 시간이 종료 되었습니다."
47+
notiContent.userInfo = ["token": ""] // 푸시 받을때 오는 데이터
48+
49+
// 알림이 trigger되는 시간 설정
50+
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)
51+
52+
let request = UNNotificationRequest(
53+
identifier: UUID().uuidString,
54+
content: notiContent,
55+
trigger: trigger
56+
)
57+
58+
self.userNotiCenter.add(request) { (error) in
59+
print(#function, error as Any)
60+
}
61+
62+
}
63+
64+
override func intervalWillStartWarning(for activity: DeviceActivityName) {
65+
super.intervalWillStartWarning(for: activity)
66+
67+
// Handle the warning before the interval starts.
68+
}
69+
70+
override func intervalWillEndWarning(for activity: DeviceActivityName) {
71+
super.intervalWillEndWarning(for: activity)
72+
//NotificationManager.shared.scheduleNotification()
73+
74+
// Handle the warning before the interval ends.
75+
76+
}
77+
78+
//threshold 시간이 되면 경고를 준다
79+
override func eventWillReachThresholdWarning(_ event: DeviceActivityEvent.Name, activity: DeviceActivityName) {
80+
super.eventWillReachThresholdWarning(event, activity: activity)
81+
//store.shield.applicationCategories = ShieldSettings.ActivityCategoryPolicy.all()
82+
let notiContent = UNMutableNotificationContent()
83+
notiContent.title = "하면함"
84+
notiContent.body = "이용 시간이 종료되었습니다. 곧 어플이 잠깁니다."
85+
notiContent.userInfo = ["status": ""] // 푸시 받을때 오는 데이터
86+
87+
// 알림이 trigger되는 시간 설정
88+
let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 1, repeats: false)
89+
90+
let request = UNNotificationRequest(
91+
identifier: UUID().uuidString,
92+
content: notiContent,
93+
trigger: trigger
94+
)
95+
96+
userNotiCenter.add(request) { (error) in
97+
print(#function, error as Any)
98+
}
99+
100+
//NotificationManager.shared.scheduleNotification()
101+
102+
}
103+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>NSExtension</key>
6+
<dict>
7+
<key>NSExtensionPointIdentifier</key>
8+
<string>com.apple.deviceactivity.monitor-extension</string>
9+
<key>NSExtensionPrincipalClass</key>
10+
<string>$(PRODUCT_MODULE_NAME).DeviceActivityMonitorExtension</string>
11+
</dict>
12+
</dict>
13+
</plist>

HMH_iOS/HMH-iOS-Info.plist

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>BASE_URL</key>
6+
<string>$(BASE_URL)</string>
7+
<key>BGTaskSchedulerPermittedIdentifiers</key>
8+
<array>
9+
<string>com.HMH.dailyTask</string>
10+
</array>
11+
<key>CFBundleURLTypes</key>
12+
<array>
13+
<dict>
14+
<key>CFBundleTypeRole</key>
15+
<string>Editor</string>
16+
<key>CFBundleURLSchemes</key>
17+
<array>
18+
<string>kakao$(KAKAO_API_KEY)</string>
19+
</array>
20+
</dict>
21+
</array>
22+
<key>KAKAO_API_KEY</key>
23+
<string>$(KAKAO_API_KEY)</string>
24+
<key>LSApplicationQueriesSchemes</key>
25+
<array>
26+
<string>kakaokompassauth</string>
27+
<string>kakaolink</string>
28+
</array>
29+
<key>NSAppTransportSecurity</key>
30+
<dict>
31+
<key>NSAllowsArbitraryLoads</key>
32+
<true/>
33+
</dict>
34+
<key>UIAppFonts</key>
35+
<array>
36+
<string>Pretendard-Regular.otf</string>
37+
<string>Pretendard-SemiBold.otf</string>
38+
<string>Pretendard-Medium.otf</string>
39+
</array>
40+
</dict>
41+
</plist>
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
//
2+
// ActivityModel.swift
3+
// HMHDeviceActivityReport
4+
//
5+
// Created by 이지희 on 5/12/24.
6+
//
7+
8+
import Foundation
9+
10+
import ManagedSettings
11+
12+
struct ActivityReport {
13+
let totalDuration: Int
14+
let titleState: [String]
15+
var remainTime: Int
16+
var totalGoalTime: Int
17+
let apps: [AppDeviceActivity]
18+
}
19+
20+
struct ChallengeActivity {
21+
let totalDuration: TimeInterval
22+
let apps: [AppDeviceActivity]
23+
}
24+
25+
struct AppDeviceActivity: Identifiable {
26+
var id: String
27+
var displayName: String
28+
var duration: TimeInterval
29+
var remainTime: TimeInterval
30+
var numberOfPickups: Int
31+
var token: ApplicationToken?
32+
}
33+
34+
struct TotalActivityModel: Identifiable {
35+
var id: String
36+
var totalTime: Int
37+
var remainTime: Int
38+
var totalGoalTime: Int
39+
var titleState: [String]
40+
}
41+
42+
extension TimeInterval {
43+
/// TimeInterval 타입 값을 00:00 형식의 String으로 변환해주는 메서드
44+
func toString() -> String {
45+
let time = NSInteger(self)
46+
let minutes = (time / 60) % 60
47+
let hours = (time / 3600)
48+
if hours < 1{
49+
return String(format: "%d분", minutes)
50+
} else {
51+
return String(format: "%d시간 %d분", hours, minutes)
52+
}
53+
}
54+
}

0 commit comments

Comments
 (0)