Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
enzevalos_iphone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
enzevalos
enzevalos_iphone
Commits
bf55485e
Commit
bf55485e
authored
7 years ago
by
kondeichmann
Browse files
Options
Downloads
Patches
Plain Diff
add Context Menu
parent
47ba7046
No related branches found
No related tags found
1 merge request
!14
Feature/invitation
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
enzevalos_iphone/SendViewController+Invitation.swift
+28
-22
28 additions, 22 deletions
enzevalos_iphone/SendViewController+Invitation.swift
enzevalos_iphone/SendViewController.swift
+6
-1
6 additions, 1 deletion
enzevalos_iphone/SendViewController.swift
with
34 additions
and
23 deletions
enzevalos_iphone/SendViewController+Invitation.swift
+
28
−
22
View file @
bf55485e
...
@@ -13,31 +13,20 @@ import UIKit
...
@@ -13,31 +13,20 @@ import UIKit
struct
InvitationSelection
{
struct
InvitationSelection
{
var
selectedWords
=
Set
<
NSRange
>
()
var
selectedWords
=
Set
<
NSRange
>
()
var
showsButton
=
false
}
}
// MARK: - SendViewController Extension
// MARK: - SendViewController Extension
extension
SendViewController
{
extension
SendViewController
{
fileprivate
func
hideMarkButton
()
{
@IBAction
fileprivate
func
encryptSelectedText
()
{
guard
(
self
.
invitationSelection
.
showsButton
==
true
)
else
{
return
}
self
.
invitationSelection
.
showsButton
=
false
self
.
scrollview
.
contentOffset
.
y
-=
50
}
}
fileprivate
func
showMarkButton
()
{
@IBAction
fileprivate
func
decryptSelectedText
()
{
guard
(
self
.
invitationSelection
.
showsButton
==
false
)
else
{
return
}
self
.
invitationSelection
.
showsButton
=
true
self
.
scrollview
.
contentOffset
.
y
+=
50
}
}
func
layoutInvitationButton
()
{
func
layoutInvitationButton
()
{
...
@@ -55,24 +44,34 @@ extension SendViewController {
...
@@ -55,24 +44,34 @@ extension SendViewController {
return
String
(
format
:
htmlString
,
self
.
textView
.
text
,
"google.com"
)
return
String
(
format
:
htmlString
,
self
.
textView
.
text
,
"google.com"
)
}
}
fileprivate
func
removeAllInvitationMarks
()
{
self
.
invitationSelection
.
selectedWords
=
Set
<
NSRange
>
()
}
fileprivate
func
menuControllerItems
(
for
textView
:
UITextView
)
->
[
UIMenuItem
]?
{
return
[
UIMenuItem
(
title
:
"verschlüsseln"
,
action
:
#selector
(
self
.
encryptSelectedText
)),
UIMenuItem
(
title
:
"entschlüsseln"
,
action
:
#selector
(
self
.
decryptSelectedText
))
]
}
}
}
// MARK: - MarkHandler
// MARK: - MarkHandler
extension
SendViewController
{
extension
SendViewController
{
/// Whenever the marked Text changed, the Buttons for "encrypting" or "decrypting" will change there visibility.
/// Whenever the marked Text changed, the Buttons for "encrypting" or "decrypting" will change there visibility.
///
///
/// - Parameter textView: that changed it's selected Text
/// - Parameter textView: that changed it's selected Text
fileprivate
func
updateMarkedText
(
for
textView
:
UITextView
)
{
func
updateMarkedText
(
for
textView
:
UITextView
)
{
guard
(
textView
.
selectedRange
.
length
!=
0
)
else
{
guard
(
self
.
isEligibleForInvitation
()
==
true
)
else
{
self
.
hideMarkButton
()
self
.
removeAllInvitationMarks
()
return
return
}
}
self
.
showMarkButton
(
)
UIMenuController
.
shared
.
menuItems
=
self
.
menuControllerItems
(
for
:
textView
)
}
}
/// Whenever text changes are made, the invitation Selection needs to be updated.
/// Whenever text changes are made, the invitation Selection needs to be updated.
...
@@ -106,6 +105,13 @@ extension SendViewController {
...
@@ -106,6 +105,13 @@ extension SendViewController {
fileprivate
func
unmarkSelectedText
(
for
textView
:
UITextView
)
{
fileprivate
func
unmarkSelectedText
(
for
textView
:
UITextView
)
{
}
}
/// Should return true, if the current recipients are insecure
///
/// - Returns: True if the current E-Mail is insecure
fileprivate
func
isEligibleForInvitation
()
->
Bool
{
return
(
self
.
toSecure
==
false
)
}
}
}
// MARK: - UITextViewDelegate
// MARK: - UITextViewDelegate
...
...
This diff is collapsed.
Click to expand it.
enzevalos_iphone/SendViewController.swift
+
6
−
1
View file @
bf55485e
...
@@ -46,7 +46,6 @@ class SendViewController: UIViewController {
...
@@ -46,7 +46,6 @@ class SendViewController: UIViewController {
var
keyboardY
:
CGFloat
=
0
var
keyboardY
:
CGFloat
=
0
var
keyboardHeight
:
CGFloat
=
0
var
keyboardHeight
:
CGFloat
=
0
var
UISecurityState
=
true
var
UISecurityState
=
true
var
toSecure
=
true
var
ccSecure
=
true
var
ccSecure
=
true
var
dataDelegate
=
VENDataDelegate
()
var
dataDelegate
=
VENDataDelegate
()
var
mailHandler
=
AppDelegate
.
getAppDelegate
()
.
mailHandler
var
mailHandler
=
AppDelegate
.
getAppDelegate
()
.
mailHandler
...
@@ -60,6 +59,12 @@ class SendViewController: UIViewController {
...
@@ -60,6 +59,12 @@ class SendViewController: UIViewController {
var
invitationSelection
=
InvitationSelection
()
var
invitationSelection
=
InvitationSelection
()
var
toSecure
=
true
{
didSet
{
self
.
updateMarkedText
(
for
:
self
.
textView
)
}
}
override
func
viewDidLoad
()
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
super
.
viewDidLoad
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment