Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PhoneManager
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yang
PhoneManager
Commits
aa7e9222
Commit
aa7e9222
authored
Apr 03, 2025
by
yqz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
没有widgets的正常版本
parent
d0038a1f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
14 additions
and
364 deletions
+14
-364
AppIntent.swift
BatteryWidget/AppIntent.swift
+0
-19
Contents.json
...Widget/Assets.xcassets/AccentColor.colorset/Contents.json
+0
-11
Contents.json
...ryWidget/Assets.xcassets/AppIcon.appiconset/Contents.json
+0
-35
Contents.json
BatteryWidget/Assets.xcassets/Contents.json
+0
-6
Contents.json
...t/Assets.xcassets/WidgetBackground.colorset/Contents.json
+0
-11
BatteryWidget.swift
BatteryWidget/BatteryWidget.swift
+0
-83
BatteryWidgetBundle.swift
BatteryWidget/BatteryWidgetBundle.swift
+0
-16
Info.plist
BatteryWidget/Info.plist
+0
-11
BatteryWidgetExtension.entitlements
BatteryWidgetExtension.entitlements
+6
-1
project.pbxproj
PhoneManager.xcodeproj/project.pbxproj
+2
-169
WidgetViewController.swift
PhoneManager/Class/Session/Widget/WidgetViewController.swift
+0
-1
PhoneManager.entitlements
PhoneManager/PhoneManager.entitlements
+6
-1
No files found.
BatteryWidget/AppIntent.swift
deleted
100644 → 0
View file @
d0038a1f
//
// AppIntent.swift
// BatteryWidget
//
// Created by edy on 2025/4/2.
//
import
WidgetKit
import
AppIntents
//struct ConfigurationAppIntent: WidgetConfigurationIntent {
// static var title: LocalizedStringResource { "Configuration" }
// static var description: IntentDescription { "This is an example widget." }
//
// // An example configurable parameter.
// @Parameter(title: "Favorite Emoji", default: "😃")
// var favoriteEmoji: String
//}
BatteryWidget/Assets.xcassets/AccentColor.colorset/Contents.json
deleted
100644 → 0
View file @
d0038a1f
{
"colors"
:
[
{
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
BatteryWidget/Assets.xcassets/AppIcon.appiconset/Contents.json
deleted
100644 → 0
View file @
d0038a1f
{
"images"
:
[
{
"idiom"
:
"universal"
,
"platform"
:
"ios"
,
"size"
:
"1024x1024"
},
{
"appearances"
:
[
{
"appearance"
:
"luminosity"
,
"value"
:
"dark"
}
],
"idiom"
:
"universal"
,
"platform"
:
"ios"
,
"size"
:
"1024x1024"
},
{
"appearances"
:
[
{
"appearance"
:
"luminosity"
,
"value"
:
"tinted"
}
],
"idiom"
:
"universal"
,
"platform"
:
"ios"
,
"size"
:
"1024x1024"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
BatteryWidget/Assets.xcassets/Contents.json
deleted
100644 → 0
View file @
d0038a1f
{
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
BatteryWidget/Assets.xcassets/WidgetBackground.colorset/Contents.json
deleted
100644 → 0
View file @
d0038a1f
{
"colors"
:
[
{
"idiom"
:
"universal"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
BatteryWidget/BatteryWidget.swift
deleted
100644 → 0
View file @
d0038a1f
//
// BatteryWidget.swift
// BatteryWidget
//
// Created by edy on 2025/4/2.
//
import
WidgetKit
import
SwiftUI
struct
Provider
:
TimelineProvider
{
func
placeholder
(
in
context
:
Context
)
->
SimpleEntry
{
SimpleEntry
(
date
:
Date
(),
type
:
0
,
style
:
0
,
battery
:
0
,
storage
:
0
)
}
func
getSnapshot
(
in
context
:
Context
,
completion
:
@escaping
(
SimpleEntry
)
->
Void
)
{
let
entry
=
loadSharedData
()
completion
(
entry
)
}
func
getTimeline
(
in
context
:
Context
,
completion
:
@escaping
(
Timeline
<
SimpleEntry
>
)
->
Void
)
{
let
entry
=
loadSharedData
()
let
timeline
=
Timeline
(
entries
:
[
entry
],
policy
:
.
after
(
Date
()
.
addingTimeInterval
(
60
)))
// 每小时更新
completion
(
timeline
)
}
private
func
loadSharedData
()
->
SimpleEntry
{
guard
let
sharedDefaults
=
UserDefaults
(
suiteName
:
"group.com.app.phonemanager"
),
let
data
:[
String
:
Int
]
=
sharedDefaults
.
object
(
forKey
:
"widgetSharedData"
)
as?
[
String
:
Int
]
else
{
return
SimpleEntry
(
date
:
Date
(),
type
:
0
,
style
:
0
,
battery
:
0
,
storage
:
0
)
}
return
SimpleEntry
(
date
:
Date
(),
type
:
0
,
style
:
0
,
battery
:
0
,
storage
:
0
)
}
}
struct
SimpleEntry
:
TimelineEntry
{
let
date
:
Date
let
type
:
Int
let
style
:
Int
let
battery
:
Int
let
storage
:
Int
}
struct
BatteryWidgetEntryView
:
View
{
var
entry
:
Provider
.
Entry
var
body
:
some
View
{
VStack
{
Text
(
"Time:"
)
Text
(
entry
.
date
,
style
:
.
time
)
}
}
}
struct
BatteryWidget
:
Widget
{
let
kind
:
String
=
"BatteryWidget"
var
body
:
some
WidgetConfiguration
{
StaticConfiguration
(
kind
:
kind
,
provider
:
Provider
())
{
entry
in
BatteryWidgetEntryView
(
entry
:
entry
)
}
}
}
//extension ConfigurationAppIntent {
// fileprivate static var smiley: ConfigurationAppIntent {
// let intent = ConfigurationAppIntent()
// intent.favoriteEmoji = "😀"
// return intent
// }
//
// fileprivate static var starEyes: ConfigurationAppIntent {
// let intent = ConfigurationAppIntent()
// intent.favoriteEmoji = "🤩"
// return intent
// }
//}
//#Preview(as: .systemSmall) {
// BatteryWidget()
//} timeline: {
// SimpleEntry(date: .now, type: 0, style: 0, battery: 24, storage: 39)
//}
BatteryWidget/BatteryWidgetBundle.swift
deleted
100644 → 0
View file @
d0038a1f
//
// BatteryWidgetBundle.swift
// BatteryWidget
//
// Created by edy on 2025/4/2.
//
import
WidgetKit
import
SwiftUI
@main
struct
BatteryWidgetBundle
:
WidgetBundle
{
var
body
:
some
Widget
{
BatteryWidget
()
}
}
BatteryWidget/Info.plist
deleted
100644 → 0
View file @
d0038a1f
<
?xml
v
e
rsion="
1
.
0
"
e
n
c
o
d
ing="UT
F
-
8
"?
>
<
!
D
O
C
TYP
E
plist
PU
B
LI
C
"-//
A
ppl
e
//
D
T
D
PLIST
1
.
0
//
E
N"
"http://www.
a
ppl
e
.
c
om/
D
T
D
s/Prop
e
rtyList-
1
.
0
.
d
t
d
"
>
<
plist
v
e
rsion="
1
.
0
"
>
<
d
i
c
t
>
<
k
e
y
>
NSExtension
<
/k
e
y
>
<
d
i
c
t
>
<
k
e
y
>
NSExtensionPointIdentifier
<
/k
e
y
>
<
string
>
com.apple.widgetkit-extension
<
/string
>
<
/
d
i
c
t
>
<
/
d
i
c
t
>
<
/plist
>
BatteryWidgetExtension.entitlements
View file @
aa7e9222
<?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/>
<dict>
<key>
com.apple.security.application-groups
</key>
<array>
<string>
group.com.app.phonemanager
</string>
</array>
</dict>
</plist>
PhoneManager.xcodeproj/project.pbxproj
View file @
aa7e9222
This diff is collapsed.
Click to expand it.
PhoneManager/Class/Session/Widget/WidgetViewController.swift
View file @
aa7e9222
...
...
@@ -99,7 +99,6 @@ class WidgetViewController: BaseViewController {
stav
.
layer
.
cornerRadius
=
20
stav
.
widgetType
=
(
self
.
widgets
==
.
battery
?
0
:
1
)
stav
.
widgetMode
=
widgetMode
// stav.clipsToBounds = true
view
.
addSubview
(
stav
)
return
stav
}()
...
...
PhoneManager/PhoneManager.entitlements
View file @
aa7e9222
<?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/>
<dict>
<key>
com.apple.security.application-groups
</key>
<array>
<string>
group.com.app.phonemanager
</string>
</array>
</dict>
</plist>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment