Commit 6c26605f authored by pete谢兆麟's avatar pete谢兆麟

微信分享接入及封装

parent 71c8a020
......@@ -75,6 +75,8 @@ target 'galaxy' do
pod 'AttributedString','3.3.5'
#json转模型
pod 'HandyJSON', '5.0.2'
#微信SDK
pod 'WechatOpenSDK', '2.0.2'
end
......
......@@ -276,6 +276,9 @@
04EA230A2BB5172F009DA928 /* YHDocumentPromptTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EA23092BB5172F009DA928 /* YHDocumentPromptTableViewCell.swift */; };
04EA230C2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EA230B2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift */; };
04EA230E2BB538E9009DA928 /* YHDocumentUploadTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EA230D2BB538E9009DA928 /* YHDocumentUploadTableViewCell.swift */; };
04EA376D2BEA06EF00DBAF64 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376C2BEA06EF00DBAF64 /* WebKit.framework */; };
04EA376F2BEA071600DBAF64 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 04EA376E2BEA070500DBAF64 /* libc++.tbd */; };
04EA37742BEA0A3400DBAF64 /* YHShareManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04EA37732BEA0A3400DBAF64 /* YHShareManager.swift */; };
04F4B76B2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */; };
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 987C69D43AE8D85DC1930DCF /* Pods_galaxy.framework */; };
A51044182B493675006B60BB /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = A51044172B493675006B60BB /* README.md */; };
......@@ -732,6 +735,9 @@
04EA23092BB5172F009DA928 /* YHDocumentPromptTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDocumentPromptTableViewCell.swift; sourceTree = "<group>"; };
04EA230B2BB5199D009DA928 /* YHDocumentToActionTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDocumentToActionTableViewCell.swift; sourceTree = "<group>"; };
04EA230D2BB538E9009DA928 /* YHDocumentUploadTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHDocumentUploadTableViewCell.swift; sourceTree = "<group>"; };
04EA376C2BEA06EF00DBAF64 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = WebKit.framework; path = System/Library/Frameworks/WebKit.framework; sourceTree = SDKROOT; };
04EA376E2BEA070500DBAF64 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; };
04EA37732BEA0A3400DBAF64 /* YHShareManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHShareManager.swift; sourceTree = "<group>"; };
04F4B76A2BAA7E1E00D13284 /* YHCertificateTemplateSheetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = YHCertificateTemplateSheetView.swift; sourceTree = "<group>"; };
19B28612265782F9DC1BE0B0 /* Pods-galaxy.testenv.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.testenv.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.testenv.xcconfig"; sourceTree = "<group>"; };
58C2405158A4A6632D0E7460 /* Pods-galaxy.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-galaxy.debug.xcconfig"; path = "Target Support Files/Pods-galaxy/Pods-galaxy.debug.xcconfig"; sourceTree = "<group>"; };
......@@ -897,7 +903,9 @@
buildActionMask = 2147483647;
files = (
6203A87EDC96313BBE789D9C /* Pods_galaxy.framework in Frameworks */,
04EA376F2BEA071600DBAF64 /* libc++.tbd in Frameworks */,
0468D42E2B5654A500CFB916 /* CoreTelephony.framework in Frameworks */,
04EA376D2BEA06EF00DBAF64 /* WebKit.framework in Frameworks */,
0468D4312B5654C100CFB916 /* libresolv.tbd in Frameworks */,
0468D4302B5654B500CFB916 /* SystemConfiguration.framework in Frameworks */,
A57F1F252B48F09200B644E6 /* ATAuthSDK_D.framework in Frameworks */,
......@@ -1621,6 +1629,7 @@
isa = PBXGroup;
children = (
0468D42A2B55019900CFB916 /* YHAnalytics.swift */,
04EA37732BEA0A3400DBAF64 /* YHShareManager.swift */,
);
path = Analytics;
sourceTree = "<group>";
......@@ -1781,6 +1790,8 @@
8D4DE9CA401A76BB1ECBE46E /* Frameworks */ = {
isa = PBXGroup;
children = (
04EA376E2BEA070500DBAF64 /* libc++.tbd */,
04EA376C2BEA06EF00DBAF64 /* WebKit.framework */,
0468D42F2B5654B500CFB916 /* SystemConfiguration.framework */,
0468D42D2B5654A500CFB916 /* CoreTelephony.framework */,
0468D42C2B56549200CFB916 /* libresolv.tbd */,
......@@ -2725,6 +2736,7 @@
045EEE942B9F171A0022A143 /* YHPreviewInfoQuestionAndAnswerItemView.swift in Sources */,
045EEED32B9F171A0022A143 /* YHScoreItemCell.swift in Sources */,
045EEEEE2B9F171A0022A143 /* YHCertificateUploadVC.swift in Sources */,
04EA37742BEA0A3400DBAF64 /* YHShareManager.swift in Sources */,
A510441A2B495DD0006B60BB /* UIView+Extension.swift in Sources */,
A5ACE93E2B4564F7002C94D2 /* UIImage+Extension.swift in Sources */,
A587F7C02BBADBE1002D9781 /* YHHKPlanItemView.swift in Sources */,
......@@ -3031,12 +3043,12 @@
);
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = galaxy/Res/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "银河港生活-Test";
INFOPLIST_KEY_CFBundleDisplayName = "银河港生活-Dev";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.business";
INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace = YES;
INFOPLIST_KEY_NSCameraUsageDescription = cameraDesciption;
INFOPLIST_KEY_NSCameraUsageDescription = "APP需要您的同意,才能使用相机进行照片拍摄来完成信息填写,如禁止将无法拍摄照片,会影响资料提交效率。";
INFOPLIST_KEY_NSFileProviderDomainUsageDescription = "需要访问您的文件以选择和上传";
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = photoLibraryDesciption;
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "APP需要您的同意,才能访问相册进行选择照片上传来完成信息填写,如禁止将无法上传选定图片,会影响资料提交效率。";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = "Launch Screen.storyboard";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
......@@ -3240,9 +3252,9 @@
INFOPLIST_KEY_CFBundleDisplayName = "银河港生活-Dev";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.business";
INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace = YES;
INFOPLIST_KEY_NSCameraUsageDescription = cameraDesciption;
INFOPLIST_KEY_NSCameraUsageDescription = "APP需要您的同意,才能使用相机进行照片拍摄来完成信息填写,如禁止将无法拍摄照片,会影响资料提交效率。";
INFOPLIST_KEY_NSFileProviderDomainUsageDescription = "需要访问您的文件以选择和上传";
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = photoLibraryDesciption;
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "APP需要您的同意,才能访问相册进行选择照片上传来完成信息填写,如禁止将无法上传选定图片,会影响资料提交效率。";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = "Launch Screen.storyboard";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
......@@ -3285,12 +3297,12 @@
);
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = galaxy/Res/Info.plist;
INFOPLIST_KEY_CFBundleDisplayName = "银河港生活";
INFOPLIST_KEY_CFBundleDisplayName = "银河港生活-Dev";
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.business";
INFOPLIST_KEY_LSSupportsOpeningDocumentsInPlace = YES;
INFOPLIST_KEY_NSCameraUsageDescription = cameraDesciption;
INFOPLIST_KEY_NSCameraUsageDescription = "APP需要您的同意,才能使用相机进行照片拍摄来完成信息填写,如禁止将无法拍摄照片,会影响资料提交效率。";
INFOPLIST_KEY_NSFileProviderDomainUsageDescription = "需要访问您的文件以选择和上传";
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = photoLibraryDesciption;
INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "APP需要您的同意,才能访问相册进行选择照片上传来完成信息填写,如禁止将无法上传选定图片,会影响资料提交效率。";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = "Launch Screen.storyboard";
INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
......
......@@ -13,7 +13,7 @@ import GKNavigationBarSwift
import DeviceKit
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
class AppDelegate: UIResponder, UIApplicationDelegate, WXApiDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
......@@ -32,7 +32,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
//4.本地用户信息加载
YHLoginManager.shared.loadLocalUserInfoData()
YHConfigManager.shared.loadConfigData()
//微信注册app
WXApi.registerApp("wx06b21f3c7a5ba594", universalLink: "https://www.galaxy-immi.com/app1/")
WXApi.startLog(by: .detail) { string in
print("\(string)")
}
//1.设置主窗口
setupRootVC()
return true
......@@ -49,6 +53,22 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func setupNavBar() {
GKConfigure.setupDefault()
}
func application(_ application: UIApplication, handleOpen url: URL) -> Bool {
return WXApi.handleOpen(url, delegate: self)
}
func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
return WXApi.handleOpen(url, delegate: self)
}
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
return WXApi.handleOpenUniversalLink(userActivity, delegate: self)
}
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]?) -> Void) -> Bool {
return WXApi.handleOpenUniversalLink(userActivity, delegate: self)
}
}
......
......@@ -60,21 +60,17 @@ private extension YHHomeKingKongBlockView {
let vc = YHFourKingViewController()
vc.id = 3
UIViewController.current?.navigationController?.pushViewController(vc)
printLog("跳转 身份福利")
case 1:
let vc = YHFourKingViewController()
vc.id = 4
UIViewController.current?.navigationController?.pushViewController(vc)
printLog("跳转 办理攻略")
case 2:
let vc = YHFourKingViewController()
vc.id = 5
UIViewController.current?.navigationController?.pushViewController(vc)
printLog("跳转 客户心声")
case 3:
let vc = YHHKEventViewController()
UIViewController.current?.navigationController?.pushViewController(vc)
printLog("跳转 香港办事")
default:
break
}
......
//
// YHShareManager.swift
// galaxy
//
// Created by EDY on 2024/5/7.
// Copyright © 2024 https://www.galaxy-immi.com. All rights reserved.
//
import UIKit
class YHShareManager: NSObject {
static let shared = YHShareManager()
var scene: WXScene = WXSceneSession
}
extension YHShareManager {
func sendTextContect(_ text: String) {
var req = SendMessageToWXReq()
req.bText = true
req.text = text
req.scene = Int32(scene.rawValue)
WXApi.send(req)
}
func sendLinkContent(_ title: String = "", _ description: String = "", _ image: UIImage = UIImage(), link: String) {
var message = WXMediaMessage()
message.title = title
message.description = description
message.setThumbImage(image)
var ext = WXWebpageObject()
ext.webpageUrl = link
message.mediaObject = ext
var req = SendMessageToWXReq()
req.bText = false
req.message = message
req.scene = Int32(scene.rawValue)
WXApi.send(req)
}
func sendVideoContent(_ title: String = "", _ description: String = "", _ image: UIImage = UIImage(), link: String) {
var message = WXMediaMessage()
message.title = title
message.description = description
message.setThumbImage(image)
var ext = WXVideoObject()
ext.videoUrl = link
message.mediaObject = ext
var req = SendMessageToWXReq()
req.bText = false
req.message = message
req.scene = Int32(scene.rawValue)
WXApi.send(req)
}
func sendImageContent(_ image: UIImage) {
var message = WXMediaMessage()
//发送的图片
var imageObject = WXImageObject()
imageObject.imageData = image.pngData() ?? Data()
message.mediaObject = imageObject
//图片缩略图
var width = 240.0 as CGFloat
var height = width*image.size.height/image.size.width
UIGraphicsBeginImageContext(CGSizeMake(width, height))
image.draw(in: CGRectMake(0, 0, width, height))
message.setThumbImage(UIGraphicsGetImageFromCurrentImageContext() ?? UIImage())
UIGraphicsEndImageContext()
var req = SendMessageToWXReq()
req.bText = false
req.message = message
req.scene = Int32(scene.rawValue)
WXApi.send(req)
}
}
......@@ -2,10 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPhotoLibraryUsageDescription</key>
<string>APP需要您的同意,才能访问相册进行选择照片上传来完成信息填写,如禁止将无法上传选定图片,会影响资料提交效率。</string>
<key>NSCameraUsageDescription</key>
<string>APP需要您的同意,才能使用相机进行照片拍摄来完成信息填写,如禁止将无法拍摄照片,会影响资料提交效率。</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
......@@ -61,6 +57,25 @@
</array>
</dict>
</array>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>weixin</string>
<key>CFBundleURLSchemes</key>
<array>
<string>wx06b21f3c7a5ba594</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>weixin</string>
<string>weixinULAPI</string>
<string>weixinURLParamsAPI</string>
</array>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
......
......@@ -11,7 +11,7 @@
#import <Bugly/Bugly.h>
#import <ATAuthSDK_D/ATAuthSDK.h>
//#import <AliyunOSSiOS/OSSService.h>
#import "WXApi.h"
#import "JPUSHService.h"
// iOS10注册APNs所需头文件
#ifdef NSFoundationVersionNumber_iOS_9_x_Max
......
......@@ -4,5 +4,10 @@
<dict>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:www.galaxy-immi.com</string>
<string>applinks:www.galaxy-immi.com</string>
</array>
</dict>
</plist>
......@@ -4,5 +4,10 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:www.galaxy-immi.com</string>
<string>applinks:www.galaxy-immi.com</string>
</array>
</dict>
</plist>
......@@ -4,5 +4,10 @@
<dict>
<key>aps-environment</key>
<string>production</string>
<key>com.apple.developer.associated-domains</key>
<array>
<string>webcredentials:www.galaxy-immi.com</string>
<string>applinks:www.galaxy-immi.com</string>
</array>
</dict>
</plist>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment