Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

version: 4.4.0 #229

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
234 changes: 151 additions & 83 deletions SampleCode/iOS/NEMeetingDemo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

50 changes: 27 additions & 23 deletions SampleCode/iOS/NEMeetingDemo/AppDelegate+MeetingExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,44 @@

@implementation AppDelegate (MeetingExtension)
- (void)meeting_addNotification {
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(resetWindow) name:kNEMeetingResetWindow object:nil];
[NSNotificationCenter.defaultCenter addObserver:self
selector:@selector(resetWindow)
name:kNEMeetingResetWindow
object:nil];
}
- (void)resetWindow {
// 需要重新初始化
[self doSetupMeetingSdk];
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [storyBoard instantiateInitialViewController];
UIApplication.sharedApplication.keyWindow.rootViewController = vc;
[UIApplication.sharedApplication.keyWindow makeKeyAndVisible];
// 需要重新初始化
[self doSetupMeetingSdk];
UIStoryboard *storyBoard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
UIViewController *vc = [storyBoard instantiateInitialViewController];
UIApplication.sharedApplication.keyWindow.rootViewController = vc;
[UIApplication.sharedApplication.keyWindow makeKeyAndVisible];
}


- (void)meeting_BeatyResource {
NSString *sourcePath = [NSBundle.mainBundle pathForResource:@"Beaty" ofType:@"bundle"];
NSArray *subPaths = [NSFileManager.defaultManager subpathsAtPath:[NSBundle.mainBundle pathForResource:@"Beaty" ofType:@"bundle"]];
for (NSString *subPath in subPaths) {
NSString *path = [sourcePath stringByAppendingPathComponent:subPath];
NSString *toPath = [[self documentPath] stringByAppendingPathComponent:subPath];
if ([self isExistFile:toPath]) {
BOOL isDelete = [NSFileManager.defaultManager removeItemAtPath:toPath error:nil];
NSLog(@"美颜资源删除%@", isDelete ? @"成功" : @"失败");
}
if ([self isExistFile:path]) {
BOOL isSuccess = [[NSFileManager defaultManager] copyItemAtPath:path toPath:toPath error:nil];
NSLog(@"美颜资源copy%@", isSuccess ? @"成功" : @"失败");
}
NSString *sourcePath = [NSBundle.mainBundle pathForResource:@"Beaty" ofType:@"bundle"];
NSArray *subPaths = [NSFileManager.defaultManager
subpathsAtPath:[NSBundle.mainBundle pathForResource:@"Beaty" ofType:@"bundle"]];
for (NSString *subPath in subPaths) {
NSString *path = [sourcePath stringByAppendingPathComponent:subPath];
NSString *toPath = [[self documentPath] stringByAppendingPathComponent:subPath];
if ([self isExistFile:toPath]) {
BOOL isDelete = [NSFileManager.defaultManager removeItemAtPath:toPath error:nil];
NSLog(@"美颜资源删除%@", isDelete ? @"成功" : @"失败");
}
if ([self isExistFile:path]) {
BOOL isSuccess = [[NSFileManager defaultManager] copyItemAtPath:path toPath:toPath error:nil];
NSLog(@"美颜资源copy%@", isSuccess ? @"成功" : @"失败");
}
}
}

- (NSString *)documentPath {
return [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
return
[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
}

- (BOOL)isExistFile:(NSString *)path {
return [NSFileManager.defaultManager fileExistsAtPath:path];
return [NSFileManager.defaultManager fileExistsAtPath:path];
}
@end
3 changes: 1 addition & 2 deletions SampleCode/iOS/NEMeetingDemo/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow * window;
@property(strong, nonatomic) UIWindow *window;
- (void)doSetupMeetingSdk;
@end

109 changes: 55 additions & 54 deletions SampleCode/iOS/NEMeetingDemo/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
// found in the LICENSE file.

#import "AppDelegate.h"
#import "ServerConfig.h"
#import "SystemAuthHelper.h"
#import "LoginInfoManager.h"
#import <NIMSDK/NIMSDK.h>
#import "AppDelegate+MeetingExtension.h"
#import "BaseViewController.h"
#import "IMLoginVC.h"
#import <NIMSDK/NIMSDK.h>
#import "LoginInfoManager.h"
#import "NSString+Demo.h"
#import "AppDelegate+MeetingExtension.h"
#import "Reachability.h"
static NSString * const prefixName = @"meetingdemo://";
#import "ServerConfig.h"
#import "SystemAuthHelper.h"
static NSString *const prefixName = @"meetingdemo://";

@interface AppDelegate ()
@property(nonatomic, strong) Reachability *reachability;
Expand All @@ -22,18 +22,19 @@ @interface AppDelegate ()

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self meeting_addNotification];
[self doSetupMeetingSdk];
[self meeting_BeatyResource];
[SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
[self monitorNetwork];
return YES;
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self meeting_addNotification];
[self doSetupMeetingSdk];
[self meeting_BeatyResource];
[SVProgressHUD setDefaultMaskType:SVProgressHUDMaskTypeBlack];
[self monitorNetwork];
return YES;
}

- (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return UIInterfaceOrientationMaskAllButUpsideDown;
- (UIInterfaceOrientationMask)application:(UIApplication *)application
supportedInterfaceOrientationsForWindow:(UIWindow *)window {
return UIInterfaceOrientationMaskAllButUpsideDown;
}
- (void)monitorNetwork {
// 添加监听器
Expand All @@ -53,48 +54,48 @@ - (void)reachabilityChanged:(NSNotification *)notification {
}
}


- (void)doSetupMeetingSdk {
if (self.isInitialized) return;
NEMeetingKitConfig *config = [[NEMeetingKitConfig alloc] init];
config.appKey = ServerConfig.current.appKey;
config.serverUrl = ServerConfig.current.sdkServerUrl;
config.appName = @"your_app_name";
config.broadcastAppGroup = @"your_app_group";

if (self.isInitialized) return;
NEMeetingKitConfig *config = [[NEMeetingKitConfig alloc] init];
config.appKey = ServerConfig.current.appKey;
config.serverUrl = ServerConfig.current.sdkServerUrl;
config.appName = @"your_app_name";
config.broadcastAppGroup = @"your_app_group";

[SVProgressHUD showWithStatus:@"初始化..."];
[[NEMeetingKit getInstance]
initialize:config
callback:^(NSInteger resultCode, NSString *resultMsg, id result) {
NSLog(@"[demo init] code:%@ msg:%@ result:%@", @(resultCode), resultMsg, result);
if (resultCode == 0) self.isInitialized = YES;
[SVProgressHUD dismiss];
[[NSNotificationCenter defaultCenter]
postNotificationName:kNEMeetingInitCompletionNotication
object:nil];
NSString *type = [[NSUserDefaults standardUserDefaults] valueForKey:@"languageType"];
[[NEMeetingKit getInstance]
switchLanguage:[self defaultLanguage:type]
callback:^(NSInteger resultCode, NSString *resultMsg, id result) {
NSLog(@"defaultLanguage: %@", type);
}];
}];
}
[SVProgressHUD showWithStatus:@"初始化..."];
[[NEMeetingKit getInstance]
initialize:config
callback:^(NSInteger resultCode, NSString *resultMsg, id result) {
NSLog(@"[demo init] code:%@ msg:%@ result:%@", @(resultCode), resultMsg, result);
if (resultCode == 0) self.isInitialized = YES;
[SVProgressHUD dismiss];
[[NSNotificationCenter defaultCenter]
postNotificationName:kNEMeetingInitCompletionNotication
object:nil];
NSString *type = [[NSUserDefaults standardUserDefaults] valueForKey:@"languageType"];
[[NEMeetingKit getInstance]
switchLanguage:[self defaultLanguage:type]
callback:^(NSInteger resultCode, NSString *resultMsg, id result) {
NSLog(@"defaultLanguage: %@", type);
}];
}];
}

- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey,id> *)options
{
if ([url.absoluteString containsString:prefixName]) {
NSDictionary *dic = [url.absoluteString queryParametersFromURLString];
NSLog(@"dic:%@",dic);
NSString *ssoToken = [dic objectForKey:@"ssoToken"]?:@"";
NSString *appKey = [dic objectForKey:@"appKey"]?:@"";
NSDictionary *ssoDict = @{@"appKey":appKey,@"ssoToken":ssoToken};
- (BOOL)application:(UIApplication *)app
openURL:(NSURL *)url
options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
if ([url.absoluteString containsString:prefixName]) {
NSDictionary *dic = [url.absoluteString queryParametersFromURLString];
NSLog(@"dic:%@", dic);
NSString *ssoToken = [dic objectForKey:@"ssoToken"] ?: @"";
NSString *appKey = [dic objectForKey:@"appKey"] ?: @"";
NSDictionary *ssoDict = @{@"appKey" : appKey, @"ssoToken" : ssoToken};

[[NSNotificationCenter defaultCenter] postNotificationName:kNEMeetingDidGetSSOToken object:ssoDict];
return YES;
}
return NO;
[[NSNotificationCenter defaultCenter] postNotificationName:kNEMeetingDidGetSSOToken
object:ssoDict];
return YES;
}
return NO;
}

- (void)applicationWillTerminate:(UIApplication *)application {
Expand Down
Loading
Loading