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
908d542d
Commit
908d542d
authored
May 28, 2024
by
Steven杜宇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
// Apple 登录
parent
53b0740b
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
123 additions
and
0 deletions
+123
-0
project.pbxproj
galaxy/galaxy.xcodeproj/project.pbxproj
+20
-0
Applegate(JPush).swift
galaxy/galaxy/Applegate(JPush).swift
+35
-0
YHAppleLoginViewController.swift
...dules/AppleLogin(苹果登录)/C/YHAppleLoginViewController.swift
+58
-0
YHMyViewController.swift
...alaxy/Classes/Modules/Mine(我的)/C/YHMyViewController.swift
+6
-0
galaxyDebug.entitlements
galaxy/galaxy/galaxyDebug.entitlements
+4
-0
No files found.
galaxy/galaxy.xcodeproj/project.pbxproj
View file @
908d542d
...
...
@@ -247,6 +247,7 @@
049537852BA9B28500AF7E59
/* YHCertificateTemplateCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049537842BA9B28500AF7E59
/* YHCertificateTemplateCell.swift */
;
};
049663BA2BF6105C003C8295
/* YHRefreshHeaderAnimator.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049663B92BF6105C003C8295
/* YHRefreshHeaderAnimator.swift */
;
};
049663C02BF729F6003C8295
/* galaxy_refresher.gif in Resources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049663BF2BF729F5003C8295
/* galaxy_refresher.gif */
;
};
0499E3042C05B91A0037E646
/* YHAppleLoginViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
0499E3032C05B91A0037E646
/* YHAppleLoginViewController.swift */
;
};
049A48A82B49417300D0C641
/* YHAboutUsViewController.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049A48A72B49417300D0C641
/* YHAboutUsViewController.swift */
;
};
049A48AA2B49536000D0C641
/* YHAboutUsAdvantageCell.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049A48A92B49536000D0C641
/* YHAboutUsAdvantageCell.swift */
;
};
049AC4C62BC3E55300F857F4
/* YHServiceSectionView.swift in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
049AC4C52BC3E55300F857F4
/* YHServiceSectionView.swift */
;
};
...
...
@@ -713,6 +714,7 @@
049537842BA9B28500AF7E59
/* YHCertificateTemplateCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHCertificateTemplateCell.swift
;
sourceTree
=
"<group>"
;
};
049663B92BF6105C003C8295
/* YHRefreshHeaderAnimator.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHRefreshHeaderAnimator.swift
;
sourceTree
=
"<group>"
;
};
049663BF2BF729F5003C8295
/* galaxy_refresher.gif */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
image.gif
;
path
=
galaxy_refresher.gif
;
sourceTree
=
"<group>"
;
};
0499E3032C05B91A0037E646
/* YHAppleLoginViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAppleLoginViewController.swift
;
sourceTree
=
"<group>"
;
};
049A48A72B49417300D0C641
/* YHAboutUsViewController.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAboutUsViewController.swift
;
sourceTree
=
"<group>"
;
};
049A48A92B49536000D0C641
/* YHAboutUsAdvantageCell.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHAboutUsAdvantageCell.swift
;
sourceTree
=
"<group>"
;
};
049AC4C52BC3E55300F857F4
/* YHServiceSectionView.swift */
=
{
isa
=
PBXFileReference
;
lastKnownFileType
=
sourcecode.swift
;
path
=
YHServiceSectionView.swift
;
sourceTree
=
"<group>"
;
};
...
...
@@ -1715,6 +1717,22 @@
path
=
CustomRefreshHeader
;
sourceTree
=
"<group>"
;
};
0499E3012C05B73D0037E646
/* AppleLogin(苹果登录) */
=
{
isa
=
PBXGroup
;
children
=
(
0499E3022C05B7E90037E646
/* C */
,
);
path
=
"AppleLogin(苹果登录)"
;
sourceTree
=
"<group>"
;
};
0499E3022C05B7E90037E646
/* C */
=
{
isa
=
PBXGroup
;
children
=
(
0499E3032C05B91A0037E646
/* YHAppleLoginViewController.swift */
,
);
path
=
C
;
sourceTree
=
"<group>"
;
};
04A671562B9F18C800C1FB91
/* MyCertificates(我的证书) */
=
{
isa
=
PBXGroup
;
children
=
(
...
...
@@ -2326,6 +2344,7 @@
A5ACE91B2B4564F7002C94D2
/* Modules */
=
{
isa
=
PBXGroup
;
children
=
(
0499E3012C05B73D0037E646
/* AppleLogin(苹果登录) */
,
0445E6AC2BE9CF53003C52F9
/* VersionUpload(版本更新) */
,
A567E5662BD7643D00D5D5A0
/* Home(首页) */
,
04174D652BCD5B74000BA46D
/* Message(消息) */
,
...
...
@@ -2999,6 +3018,7 @@
045EEF092B9F171A0022A143
/* YHBasicInfoFillModel.swift in Sources */
,
A5ACE9352B4564F7002C94D2
/* YHNetRequest.swift in Sources */
,
A5FD63CB2B63D6C300D1D9DA
/* YHInformationFillTipsCell.swift in Sources */
,
0499E3042C05B91A0037E646
/* YHAppleLoginViewController.swift in Sources */
,
045EEF1F2B9F171A0022A143
/* YHDatePickView.swift in Sources */
,
04174D7A2BCD5B74000BA46D
/* YHDetailMessageCell.swift in Sources */
,
045EEE972B9F171A0022A143
/* YHPreviewInfoWorkExpView.swift in Sources */
,
...
...
galaxy/galaxy/Applegate(JPush).swift
View file @
908d542d
...
...
@@ -7,6 +7,7 @@
//
import
UIKit
import
AuthenticationServices
extension
AppDelegate
:
JPUSHRegisterDelegate
{
...
...
@@ -133,3 +134,37 @@ extension AppDelegate: JPUSHRegisterDelegate {
}
}
extension
AppDelegate
{
func
handleAppleLoginUser
()
{
if
#available(iOS 13.0, *)
{
// 注意 存储用户标识信息需要使用钥匙串来存储 这里使用NSUserDefaults 做的简单示例
let
userIdentifier
=
UserDefaults
.
standard
.
value
(
forKey
:
"appleID"
)
as?
String
if
let
userIdentifier
=
userIdentifier
{
let
appleIDProvider
=
ASAuthorizationAppleIDProvider
()
appleIDProvider
.
getCredentialState
(
forUserID
:
userIdentifier
)
{
credentialState
,
error
in
switch
credentialState
{
case
.
authorized
:
// 授权状态有效
break
case
.
revoked
:
// 苹果账号登录的凭据已被移除,需解除绑定并重新引导用户使用苹果登录
break
case
.
notFound
:
// 未登录授权,直接弹出登录页面,引导用户登录
break
case
.
transferred
:
// 授权AppleID提供者凭据转移
break
default
:
break
}
}
}
}
}
}
galaxy/galaxy/Classes/Modules/AppleLogin(苹果登录)/C/YHAppleLoginViewController.swift
0 → 100644
View file @
908d542d
//
// YHAppleLoginViewController.swift
// galaxy
//
// Created by edy on 2024/5/28.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import
UIKit
import
AuthenticationServices
class
YHAppleLoginViewController
:
YHBaseViewController
{
override
func
viewDidLoad
()
{
super
.
viewDidLoad
()
setupUI
()
}
func
setupUI
()
{
let
appleLoginBtn
:
ASAuthorizationAppleIDButton
=
ASAuthorizationAppleIDButton
.
init
(
authorizationButtonType
:
.
default
,
authorizationButtonStyle
:
.
white
)
appleLoginBtn
.
frame
=
CGRectMake
(
50
,
200
,
KScreenWidth
-
100
,
45
)
self
.
view
.
addSubview
(
appleLoginBtn
)
appleLoginBtn
.
addTarget
(
self
,
action
:
#selector(
didAppleIDBtnClicked
)
,
for
:
.
touchUpInside
)
view
.
addSubview
(
appleLoginBtn
)
}
@objc
func
didAppleIDBtnClicked
()
{
let
provider
=
ASAuthorizationAppleIDProvider
()
let
request
=
provider
.
createRequest
()
request
.
requestedScopes
=
[
ASAuthorization
.
Scope
.
fullName
,
ASAuthorization
.
Scope
.
email
]
let
keychainRequest
=
ASAuthorizationPasswordProvider
()
.
createRequest
()
let
vc
=
ASAuthorizationController
(
authorizationRequests
:
[
request
,
keychainRequest
])
vc
.
delegate
=
self
vc
.
presentationContextProvider
=
self
vc
.
performRequests
()
}
}
extension
YHAppleLoginViewController
:
ASAuthorizationControllerDelegate
,
ASAuthorizationControllerPresentationContextProviding
{
func
authorizationController
(
controller
:
ASAuthorizationController
,
didCompleteWithAuthorization
authorization
:
ASAuthorization
)
{
// 其中`authorization.credential`包含了Token,用户ID等授权所需信息,可上报到后台
}
func
authorizationController
(
controller
:
ASAuthorizationController
,
didCompleteWithError
error
:
Error
)
{
}
func
presentationAnchor
(
for
controller
:
ASAuthorizationController
)
->
ASPresentationAnchor
{
return
UIApplication
.
shared
.
yhKeyWindow
()
!
}
}
galaxy/galaxy/Classes/Modules/Mine(我的)/C/YHMyViewController.swift
View file @
908d542d
...
...
@@ -268,6 +268,12 @@ extension YHMyViewController : UITableViewDelegate, UITableViewDataSource {
if
(
indexPath
.
row
>=
items
.
count
)
{
return
}
if
true
{
let
vc
=
YHAppleLoginViewController
()
self
.
navigationController
?
.
pushViewController
(
vc
)
return
}
//#if DEBUG
// let vc = YHCodeSueecssWithVideoBkgViewController()
// vc.phoneNumber = "15818743775"
...
...
galaxy/galaxy/galaxyDebug.entitlements
View file @
908d542d
...
...
@@ -4,6 +4,10 @@
<dict>
<key>
aps-environment
</key>
<string>
development
</string>
<key>
com.apple.developer.applesignin
</key>
<array>
<string>
Default
</string>
</array>
<key>
com.apple.developer.associated-domains
</key>
<array>
<string>
webcredentials:www.galaxy-immi.com
</string>
...
...
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