Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
9819c93f
Commit
9819c93f
authored
Nov 26, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// AI
parent
ff737973
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
59 additions
and
7 deletions
+59
-7
YHAutoTextView.swift
galaxy/galaxy/Classes/Base/V/YHAutoTextView.swift
+15
-2
YHAIViewController.swift
...s/Modules/AI/AI-Dialogue(AI对话)/C/YHAIViewController.swift
+0
-1
YHAITextInputView.swift
...es/Modules/AI/AI-Dialogue(AI对话)/V/YHAITextInputView.swift
+16
-4
Contents.json
galaxy/galaxy/Res/Assets.xcassets/AI-Chat/Contents.json
+6
-0
Contents.json
...sets.xcassets/AI-Chat/ai_chat_send.imageset/Contents.json
+22
-0
Frame-1.png
...Assets.xcassets/AI-Chat/ai_chat_send.imageset/Frame-1.png
+0
-0
Frame.png
...s/Assets.xcassets/AI-Chat/ai_chat_send.imageset/Frame.png
+0
-0
No files found.
galaxy/galaxy/Classes/Base/V/YHAutoTextView.swift
View file @
9819c93f
...
@@ -10,14 +10,18 @@ import UIKit
...
@@ -10,14 +10,18 @@ import UIKit
class
YHAutoTextView
:
UITextView
,
UITextViewDelegate
{
class
YHAutoTextView
:
UITextView
,
UITextViewDelegate
{
var
textChange
:((
String
)
->
())?
override
open
var
text
:
String
!
{
override
open
var
text
:
String
!
{
didSet
{
didSet
{
textViewDidChange
(
self
)
self
.
setNeedsLayout
()
self
.
setNeedsLayout
()
self
.
layoutIfNeeded
()
self
.
layoutIfNeeded
()
}
}
}
}
let
maxHeight
=
105.0
let
maxHeight
=
60.0
static
let
verticalGap
=
5.0
var
placeHolder
:
String
=
""
{
var
placeHolder
:
String
=
""
{
didSet
{
didSet
{
placeholderLabel
.
text
=
placeHolder
placeholderLabel
.
text
=
placeHolder
...
@@ -54,7 +58,7 @@ class YHAutoTextView: UITextView, UITextViewDelegate {
...
@@ -54,7 +58,7 @@ class YHAutoTextView: UITextView, UITextViewDelegate {
// 更新自身的高度
// 更新自身的高度
invalidateIntrinsicContentSize
()
invalidateIntrinsicContentSize
()
placeholderLabel
.
isHidden
=
!
textView
.
text
.
isEmpty
placeholderLabel
.
isHidden
=
!
textView
.
text
.
isEmpty
text
=
textView
.
text
text
Change
?(
textView
.
text
)
}
}
override
var
intrinsicContentSize
:
CGSize
{
override
var
intrinsicContentSize
:
CGSize
{
...
@@ -72,6 +76,15 @@ class YHAutoTextView: UITextView, UITextViewDelegate {
...
@@ -72,6 +76,15 @@ class YHAutoTextView: UITextView, UITextViewDelegate {
isScrollEnabled
=
height
>
maxHeight
isScrollEnabled
=
height
>
maxHeight
if
height
>
maxHeight
{
if
height
>
maxHeight
{
height
=
maxHeight
height
=
maxHeight
self
.
snp
.
updateConstraints
{
make
in
make
.
top
.
equalTo
(
11
)
make
.
bottom
.
equalTo
(
-
11
)
}
}
else
{
self
.
snp
.
updateConstraints
{
make
in
make
.
top
.
equalTo
(
11
-
Self
.
verticalGap
)
make
.
bottom
.
equalTo
(
-
(
11
-
Self
.
verticalGap
))
}
}
}
return
CGSize
(
width
:
size
.
width
,
height
:
height
)
return
CGSize
(
width
:
size
.
width
,
height
:
height
)
}
}
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/C/YHAIViewController.swift
View file @
9819c93f
...
@@ -68,7 +68,6 @@ class YHAIViewController: YHBaseViewController {
...
@@ -68,7 +68,6 @@ class YHAIViewController: YHBaseViewController {
bottomInputView
.
snp
.
makeConstraints
{
make
in
bottomInputView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
right
.
bottom
.
equalToSuperview
()
make
.
left
.
right
.
bottom
.
equalToSuperview
()
}
}
}
}
func
handleMessage
(
_
res
:
YHAIResponse
)
{
func
handleMessage
(
_
res
:
YHAIResponse
)
{
...
...
galaxy/galaxy/Classes/Modules/AI/AI-Dialogue(AI对话)/V/YHAITextInputView.swift
View file @
9819c93f
...
@@ -31,20 +31,32 @@ class YHAITextInputView: UIView {
...
@@ -31,20 +31,32 @@ class YHAITextInputView: UIView {
lazy
var
sendBtn
:
UIButton
=
{
lazy
var
sendBtn
:
UIButton
=
{
let
btn
=
UIButton
(
type
:
.
custom
)
let
btn
=
UIButton
(
type
:
.
custom
)
btn
.
backgroundColor
=
.
red
btn
.
setImage
(
UIImage
(
named
:
"ai_chat_send"
),
for
:
.
normal
)
btn
.
addTarget
(
self
,
action
:
#selector(
didSendButtonClicked
)
,
for
:
.
touchUpInside
)
btn
.
addTarget
(
self
,
action
:
#selector(
didSendButtonClicked
)
,
for
:
.
touchUpInside
)
btn
.
YH_clickEdgeInsets
=
UIEdgeInsets
(
top
:
20
,
left
:
20
,
bottom
:
20
,
right
:
20
)
btn
.
YH_clickEdgeInsets
=
UIEdgeInsets
(
top
:
20
,
left
:
20
,
bottom
:
20
,
right
:
20
)
btn
.
alpha
=
0.3
btn
.
isEnabled
=
false
return
btn
return
btn
}()
}()
@objc
func
didSendButtonClicked
()
{
@objc
func
didSendButtonClicked
()
{
sendBlock
?(
textView
.
text
)
sendBlock
?(
textView
.
text
)
textView
.
text
=
""
textView
.
text
=
""
textView
.
isScrollEnabled
=
false
sendBtn
.
alpha
=
0.3
sendBtn
.
isEnabled
=
false
self
.
endEditing
(
true
)
}
}
var
textView
:
YHAutoTextView
=
{
lazy
var
textView
:
YHAutoTextView
=
{
let
v
=
YHAutoTextView
()
let
v
=
YHAutoTextView
()
v
.
font
=
.
PFSC_R
(
ofSize
:
14
)
v
.
font
=
.
PFSC_R
(
ofSize
:
14
)
v
.
textChange
=
{
[
weak
self
]
text
in
guard
let
self
=
self
else
{
return
}
sendBtn
.
alpha
=
text
.
count
>
0
?
1.0
:
0.3
sendBtn
.
isEnabled
=
text
.
count
>
0
}
return
v
return
v
}()
}()
...
@@ -97,8 +109,8 @@ class YHAITextInputView: UIView {
...
@@ -97,8 +109,8 @@ class YHAITextInputView: UIView {
textView
.
snp
.
makeConstraints
{
make
in
textView
.
snp
.
makeConstraints
{
make
in
make
.
left
.
equalTo
(
5
)
make
.
left
.
equalTo
(
5
)
make
.
top
.
equalTo
(
4
)
make
.
top
.
equalTo
(
11
-
YHAutoTextView
.
verticalGap
)
make
.
bottom
.
equalTo
(
-
4
)
make
.
bottom
.
equalTo
(
-
(
11
-
YHAutoTextView
.
verticalGap
)
)
make
.
right
.
equalTo
(
sendBtn
.
snp
.
left
)
.
offset
(
-
5
)
make
.
right
.
equalTo
(
sendBtn
.
snp
.
left
)
.
offset
(
-
5
)
}
}
addKeyBoardNotify
()
addKeyBoardNotify
()
...
...
galaxy/galaxy/Res/Assets.xcassets/AI-Chat/Contents.json
0 → 100644
View file @
9819c93f
{
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
galaxy/galaxy/Res/Assets.xcassets/AI-Chat/ai_chat_send.imageset/Contents.json
0 → 100644
View file @
9819c93f
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"filename"
:
"Frame.png"
,
"idiom"
:
"universal"
,
"scale"
:
"2x"
},
{
"filename"
:
"Frame-1.png"
,
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"author"
:
"xcode"
,
"version"
:
1
}
}
galaxy/galaxy/Res/Assets.xcassets/AI-Chat/ai_chat_send.imageset/Frame-1.png
0 → 100644
View file @
9819c93f
1.55 KB
galaxy/galaxy/Res/Assets.xcassets/AI-Chat/ai_chat_send.imageset/Frame.png
0 → 100644
View file @
9819c93f
1.16 KB
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