diff --git a/Oncenote.xcodeproj/project.pbxproj b/Oncenote.xcodeproj/project.pbxproj index b99ee14..1c90ccd 100644 --- a/Oncenote.xcodeproj/project.pbxproj +++ b/Oncenote.xcodeproj/project.pbxproj @@ -7,6 +7,7 @@ objects = { /* Begin PBXBuildFile section */ + 715CB76D1BF99B1A0079DB35 /* shareImg.png in Resources */ = {isa = PBXBuildFile; fileRef = 715CB76C1BF99B1A0079DB35 /* shareImg.png */; settings = {ASSET_TAGS = (); }; }; 717902EA1BF48FC100428756 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 717902E91BF48FC100428756 /* main.m */; }; 717902ED1BF48FC100428756 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 717902EC1BF48FC100428756 /* AppDelegate.m */; }; 717902F01BF48FC100428756 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 717902EF1BF48FC100428756 /* MainViewController.m */; }; @@ -97,6 +98,7 @@ /* Begin PBXFileReference section */ 042E519FF0D448E00C6B94EE /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = ""; }; 52A3A8C36BAD439F0DCC8BC9 /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 715CB76C1BF99B1A0079DB35 /* shareImg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = shareImg.png; sourceTree = ""; }; 717902E51BF48FC100428756 /* Oncenote.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Oncenote.app; sourceTree = BUILT_PRODUCTS_DIR; }; 717902E91BF48FC100428756 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 717902EB1BF48FC100428756 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; @@ -362,6 +364,7 @@ 71A793801BF5E7AD00410FFC /* Resource */ = { isa = PBXGroup; children = ( + 715CB76C1BF99B1A0079DB35 /* shareImg.png */, 717902F41BF48FC100428756 /* Assets.xcassets */, 717902F91BF48FC100428756 /* Info.plist */, ); @@ -544,6 +547,7 @@ 717902F81BF48FC100428756 /* LaunchScreen.storyboard in Resources */, 717902F51BF48FC100428756 /* Assets.xcassets in Resources */, 717902F31BF48FC100428756 /* Main.storyboard in Resources */, + 715CB76D1BF99B1A0079DB35 /* shareImg.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -750,6 +754,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_BITCODE = YES; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -794,6 +799,7 @@ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_BITCODE = YES; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; @@ -875,6 +881,7 @@ baseConfigurationReference = 042E519FF0D448E00C6B94EE /* Pods.debug.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ENABLE_BITCODE = YES; INFOPLIST_FILE = Oncenote/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.chenyufengweb.Oncenote; @@ -887,6 +894,7 @@ baseConfigurationReference = C6D3406A90F2A54E2CBA0100 /* Pods.release.xcconfig */; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + ENABLE_BITCODE = YES; INFOPLIST_FILE = Oncenote/Info.plist; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.chenyufengweb.Oncenote; diff --git a/Oncenote/AddNoteViewController.m b/Oncenote/AddNoteViewController.m index d5f15cf..ee2e97e 100644 --- a/Oncenote/AddNoteViewController.m +++ b/Oncenote/AddNoteViewController.m @@ -11,6 +11,8 @@ #import "Constant.h" #import "AppDelegate.h" #import "MainViewController.h" +#import "AllUtils.h" + @interface AddNoteViewController () @@ -41,36 +43,29 @@ - (IBAction)naviStoreButtonPressed:(id)sender { if (![noteTitle isEqual: @""] && ![noteText isEqual: @""]){ -// BmobOperation *operate = [[BmobOperation alloc] init]; + // BmobOperation *operate = [[BmobOperation alloc] init]; [BmobOperation addNoteToNoteTable:NOTE_TABLE userId:userId username:username noteTitle:noteTitle noteText:noteText todo:^(BOOL isSuccessful, NSError *error) { if (isSuccessful) { - [self showPromptDialog:@"提示" andMessage:@"增加一条笔记成功" andButton:@"确定" andAction:^(UIAlertAction *action) { + + [AllUtils showPromptDialog:@"提示" andMessage:@"增加一条笔记成功" OKButton:@"确定" OKButtonAction:^(UIAlertAction *action) { //跳回到主界面; UIViewController *mainViewController = [[UIViewController alloc] init]; mainViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"MainViewController"]; [self presentViewController:mainViewController animated:true completion:nil]; NSLog(@"回到主界面"); - }]; + } cancelButton:@"" cancelButtonAction:nil contextViewController:self]; + + }else { - [self showPromptDialog:@"提示" andMessage:@"服务器异常,增加笔记失败。" andButton:@"确定" andAction:nil]; + [AllUtils showPromptDialog:@"提示" andMessage:@"服务器异常,增加笔记失败!" OKButton:@"确定" OKButtonAction:nil cancelButton:@"" cancelButtonAction:nil contextViewController:self]; } }]; }else{ - [self showPromptDialog:@"提示" andMessage:@"标题和内容缺一不可。" andButton:@"确定" andAction:nil]; + [AllUtils showPromptDialog:@"提示" andMessage:@"标题和内容缺一不可!" OKButton:@"确定" OKButtonAction:nil cancelButton:@"" cancelButtonAction:nil contextViewController:self]; } } -#pragma mark - 弹出提示对话框 -- (void)showPromptDialog:(NSString*)title andMessage:(NSString*)message andButton:(NSString*)buttonTitle andAction:(void (^ __nullable)(UIAlertAction *action)) handler{ - - //尝试使用新的弹出对话框; - UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; - [alertController addAction:[UIAlertAction actionWithTitle:buttonTitle style:UIAlertActionStyleDefault handler:handler]]; - //弹出提示框; - [self presentViewController:alertController animated:true completion:nil]; -} - @end diff --git a/Oncenote/AllNoteDetailViewController.m b/Oncenote/AllNoteDetailViewController.m index 09c9b65..de227c5 100644 --- a/Oncenote/AllNoteDetailViewController.m +++ b/Oncenote/AllNoteDetailViewController.m @@ -13,6 +13,10 @@ #import "AppDelegate.h" #import "MainViewController.h" +#import +#import +#import "AllUtils.h" + @interface AllNoteDetailViewController () @property (weak, nonatomic) IBOutlet UIImageView *backImageView; @@ -39,17 +43,57 @@ - (void)viewDidLoad { //控件绑定操作; [self.backImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(allNoteDetailBackButtonPressed:)]]; + [self.shareImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(allNoteDetailShareButtonPressed:)]]; } #pragma mark - 所有的按钮点击操作 - (void) allNoteDetailBackButtonPressed:(id)sender{ - + [self updateBmobObject:NOTE_TABLE noteId:self.noteId noteTitle:self.noteTitleTextField.text noteText:self.noteTextTextView.text]; } +- (void) allNoteDetailShareButtonPressed:(id)sender{ + + NSArray* imageArray = @[[UIImage imageNamed:@"shareImg.png"]]; + + if (imageArray) { + + NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; + [shareParams SSDKSetupShareParamsByText:[NSString stringWithFormat:@"标题:%@\n内容:%@",self.noteTitleTextField.text,self.noteTextTextView.text] + images:nil + url:nil + title:self.noteTitleTextField.text + type:SSDKContentTypeAuto]; + [ShareSDK showShareActionSheet:nil + items:nil + shareParams:shareParams + onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { + + switch (state) { + case SSDKResponseStateSuccess: + { + [AllUtils showPromptDialog:@"提示" andMessage:@"分享成功" OKButton:@"确定" OKButtonAction:nil cancelButton:@"" cancelButtonAction:nil contextViewController:self]; + break; + } + case SSDKResponseStateFail: + { + [AllUtils showPromptDialog:@"提示" andMessage:[NSString stringWithFormat:@"分享失败:%@",error] OKButton:@"确定" OKButtonAction:nil cancelButton:@"" cancelButtonAction:nil contextViewController:self]; + break; + } + default: + break; + } + + }]; + + } + + +} + #pragma mark - 修改笔记 -(void)updateBmobObject:(NSString*)tableName noteId:(NSString*)noteId noteTitle:(NSString*)noteTitle noteText:(NSString*)noteText{ //查找GameScore表 diff --git a/Oncenote/AllUtils.h b/Oncenote/AllUtils.h index ac9504c..a889d2a 100644 --- a/Oncenote/AllUtils.h +++ b/Oncenote/AllUtils.h @@ -7,9 +7,12 @@ // #import +#import @interface AllUtils : NSObject + (NSString *)getDateFromString:(NSString*)date; + ++ (UIAlertController*)showPromptDialog:(NSString*)title andMessage:(NSString*)message OKButton:(NSString*)OKButtonTitle OKButtonAction:(void (^)(UIAlertAction *action))OKButtonHandler cancelButton:(NSString*)cancelButtonTitle cancelButtonAction:(void (^)(UIAlertAction *action))cancelButtonHandler contextViewController:(UIViewController*)contextViewController; @end diff --git a/Oncenote/AllUtils.m b/Oncenote/AllUtils.m index f0807a1..0b12931 100644 --- a/Oncenote/AllUtils.m +++ b/Oncenote/AllUtils.m @@ -40,4 +40,35 @@ + (NSString *)getDateFromString:(NSString*)date{ return str2; } +#pragma mark - 弹出提示对话框 ++ (UIAlertController*)showPromptDialog:(NSString*)title andMessage:(NSString*)message OKButton:(NSString*)OKButtonTitle OKButtonAction:(void (^)(UIAlertAction *action))OKButtonHandler cancelButton:(NSString*)cancelButtonTitle cancelButtonAction:(void (^)(UIAlertAction *action))cancelButtonHandler contextViewController:(UIViewController*)contextViewController{ + + //尝试使用新的弹出对话框; + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; + [alertController addAction:[UIAlertAction actionWithTitle:OKButtonTitle style:UIAlertActionStyleDefault handler:OKButtonHandler]]; + + if ([cancelButtonTitle isEqualToString:@""]) { + //表示不需要“取消”按钮; + }else{ + //需要“取消”按钮; + [alertController addAction:[UIAlertAction actionWithTitle:cancelButtonTitle style:UIAlertActionStyleDefault handler:cancelButtonHandler]]; + } + + //弹出提示框; + [contextViewController presentViewController:alertController animated:true completion:nil]; + + return alertController; +} + @end + + + + + + + + + + + diff --git a/Oncenote/AppDelegate.m b/Oncenote/AppDelegate.m index 3f43360..8381817 100644 --- a/Oncenote/AppDelegate.m +++ b/Oncenote/AppDelegate.m @@ -84,8 +84,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:( authType:SSDKAuthTypeBoth]; break; case SSDKPlatformTypeWechat: - [appInfo SSDKSetupWeChatByAppId:@"wx4868b35061f87885" - appSecret:@"64020361b8ec4c99936c0e3999a9f249"]; + [appInfo SSDKSetupWeChatByAppId:@"wxa7be3ef36352dc5c" + appSecret:@"d4624c36b6795d1d99dcf0547af5443d"]; break; case SSDKPlatformTypeQQ: [appInfo SSDKSetupQQByAppId:@"1104897411" diff --git a/Oncenote/Info.plist b/Oncenote/Info.plist index 6256730..fcbc338 100644 --- a/Oncenote/Info.plist +++ b/Oncenote/Info.plist @@ -2,8 +2,32 @@ + LSApplicationQueriesSchemes + + mqqOpensdkSSoLogin + mqzone + sinaweibo + alipayauth + alipay + safepay + mqq + mqqapi + mqqopensdkapiV3 + mqqopensdkapiV2 + mqqapiwallet + mqqwpa + mqqbrowser + wtloginmqq2 + weixin + wechat + mqzoneopensdkapiV2 + mqzoneopensdkapi19 + mqzoneopensdkapi + mqzoneopensdk + qzapp + CFBundleDevelopmentRegion - en + zh_CN CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier @@ -18,6 +42,29 @@ 1.0 CFBundleSignature ???? + CFBundleURLTypes + + + CFBundleTypeRole + Editor + CFBundleURLName + weixin + CFBundleURLSchemes + + wxa7be3ef36352dc5c + + + + CFBundleTypeRole + Editor + CFBundleURLName + qq + CFBundleURLSchemes + + QQ41DB6583 + + + CFBundleVersion 1 LSRequiresIPhoneOS diff --git a/Oncenote/MainViewController.m b/Oncenote/MainViewController.m index a2e6dbc..ef164de 100644 --- a/Oncenote/MainViewController.m +++ b/Oncenote/MainViewController.m @@ -70,29 +70,23 @@ - (void)viewDidLoad { #pragma mark - 所有的按钮点击事件 //点击导航栏左侧的设置按钮; - (void)naviSettingButtonPressed:(id)sender{ - UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"这是设置按钮" preferredStyle: UIAlertControllerStyleAlert]; - [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - //点击按钮的响应事件; - }]]; + + [AllUtils showPromptDialog:@"提示" andMessage:@"这里是提示信息" OKButton:@"确定" OKButtonAction:^(UIAlertAction *action) { + NSLog(@"点击确定按钮"); + } cancelButton:@"取消" cancelButtonAction:^(UIAlertAction *action) { + NSLog(@"点击取消按钮"); + } contextViewController:self]; - [self presentViewController:alert animated:true completion:nil]; + } - (void)naviRefreshButtonPressed:(id)sender{ - UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"提示" message:@"这是刷新按钮" preferredStyle: UIAlertControllerStyleAlert]; - [alert addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) { - //点击按钮的响应事件; - }]]; - - [self presentViewController:alert animated:true completion:nil]; } //点击导航栏搜索按钮; - (void)naviSearchButtonPressed:(id)sender{ - // NSLog(@"点击了搜索按钮"); - } diff --git a/Oncenote/NoteDetailViewController.m b/Oncenote/NoteDetailViewController.m index cc5071c..3b4d278 100644 --- a/Oncenote/NoteDetailViewController.m +++ b/Oncenote/NoteDetailViewController.m @@ -11,6 +11,9 @@ #import "MainViewController.h" #import "AppDelegate.h" #import "Constant.h" +#import +#import +#import "AllUtils.h" @interface NoteDetailViewController () @@ -37,6 +40,9 @@ - (void)viewDidLoad { //控件绑定操作; [self.backImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(noteDetailBackButtonPressed:)]]; + [self.shareImageView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(noteDetailShareButtonPressed:)]]; + + } @@ -53,6 +59,43 @@ - (void) noteDetailBackButtonPressed:(id)sender{ } +- (void) noteDetailShareButtonPressed:(id)sender{ + NSArray* imageArray = @[[UIImage imageNamed:@"shareImg.png"]]; + + if (imageArray) { + + NSMutableDictionary *shareParams = [NSMutableDictionary dictionary]; + [shareParams SSDKSetupShareParamsByText:[NSString stringWithFormat:@"标题:%@\n内容:%@",self.noteTitleTextField.text,self.noteTextTextView.text] + images:nil + url:nil + title:self.noteTitleTextField.text + type:SSDKContentTypeAuto]; + [ShareSDK showShareActionSheet:nil + items:nil + shareParams:shareParams + onShareStateChanged:^(SSDKResponseState state, SSDKPlatformType platformType, NSDictionary *userData, SSDKContentEntity *contentEntity, NSError *error, BOOL end) { + + switch (state) { + case SSDKResponseStateSuccess: + { + [AllUtils showPromptDialog:@"提示" andMessage:@"分享成功" OKButton:@"确定" OKButtonAction:nil cancelButton:@"" cancelButtonAction:nil contextViewController:self]; + break; + } + case SSDKResponseStateFail: + { + [AllUtils showPromptDialog:@"提示" andMessage:[NSString stringWithFormat:@"分享失败:%@",error] OKButton:@"确定" OKButtonAction:nil cancelButton:@"" cancelButtonAction:nil contextViewController:self]; + break; + } + default: + break; + } + + }]; + + } +} + + #pragma mark - 修改笔记 -(void)updateBmobObject:(NSString*)tableName noteId:(NSString*)noteId noteTitle:(NSString*)noteTitle noteText:(NSString*)noteText{ //查找GameScore表 diff --git a/Oncenote/RegisterViewController.m b/Oncenote/RegisterViewController.m index a0ff74d..7b31677 100644 --- a/Oncenote/RegisterViewController.m +++ b/Oncenote/RegisterViewController.m @@ -8,6 +8,7 @@ #import "RegisterViewController.h" #import +#import "AllUtils.h" @interface RegisterViewController () @@ -35,16 +36,20 @@ - (IBAction)createAccountButtonPressed:(id)sender { [user setPassword:password]; [user signUpInBackgroundWithBlock:^(BOOL isSuccessful, NSError *error) { if (isSuccessful) { - NSLog(@"注册成功"); - [self showPromptDialog:@"提示" andMessage:@"注册成功,请登录" andButton:@"确定" andAction:nil]; + [AllUtils showPromptDialog:@"提示" andMessage:@"注册成功,请登录!" OKButton:@"确定" OKButtonAction:^(UIAlertAction *action) { + NSLog(@"注册成功"); + } cancelButton:@"" cancelButtonAction:nil contextViewController:self]; + }else{ - NSLog(@"注册失败"); - [self showPromptDialog:@"提示" andMessage:@"服务器异常,注册失败。" andButton:@"确定" andAction:nil]; + [AllUtils showPromptDialog:@"提示" andMessage:@"服务器异常,注册失败!" OKButton:@"确定" OKButtonAction:^(UIAlertAction *action) { + NSLog(@"注册失败"); + } cancelButton:@"" cancelButtonAction:nil contextViewController:self]; } }]; }else{ - NSLog(@"请输入信息"); - [self showPromptDialog:@"提示" andMessage:@"请填写完整信息。" andButton:@"确定" andAction:nil]; + [AllUtils showPromptDialog:@"提示" andMessage:@"请填写完整信息!" OKButton:@"确定" OKButtonAction:^(UIAlertAction *action) { + NSLog(@"请输入信息"); + } cancelButton:@"" cancelButtonAction:nil contextViewController:self]; } } @@ -56,14 +61,4 @@ - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{ } -#pragma mark - 弹出提示对话框 -- (void)showPromptDialog:(NSString*)title andMessage:(NSString*)message andButton:(NSString*)buttonTitle andAction:(void (^ __nullable)(UIAlertAction *action)) handler{ - - //尝试使用新的弹出对话框; - UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert]; - [alertController addAction:[UIAlertAction actionWithTitle:buttonTitle style:UIAlertActionStyleDefault handler:handler]]; - //弹出提示框; - [self presentViewController:alertController animated:true completion:nil]; -} - @end diff --git a/Oncenote/shareImg.png b/Oncenote/shareImg.png new file mode 100644 index 0000000..b368a8e Binary files /dev/null and b/Oncenote/shareImg.png differ