Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #206 from NIFCLOUD-mbaas/develop
Browse files Browse the repository at this point in the history
リリース 3.0.3 (DEV->MASTER)
  • Loading branch information
kobo0908 authored Dec 5, 2019
2 parents f5da92f + b701920 commit 6afaa55
Show file tree
Hide file tree
Showing 15 changed files with 1,810 additions and 146 deletions.
6 changes: 3 additions & 3 deletions NCMB.podspec
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Pod::Spec.new do |s|
s.name = "NCMB"
s.version = "3.0.2"
s.version = "3.0.3"
s.summary = "NCMB is SDK for NIFCLOUD mobile backend."
s.description = <<-DESC
NCMB is SDK for NIFCLOUD mobile backend.
NIF Cloud mobile backend function
NIFCLOUD mobile backend function
* Data store
* Push Notification
* User Management
Expand All @@ -15,7 +15,7 @@ Pod::Spec.new do |s|
s.license = "Apache License, Version 2.0"
s.author = "FUJITSU CLOUD TECHNOLOGIES LIMITED"
s.platform = :ios, "5.1"
s.source = { :git => 'https://github.com/NIFCloud-mbaas/ncmb_ios.git', :tag => 'v3.0.2' }
s.source = { :git => 'https://github.com/NIFCLOUD-mbaas/ncmb_ios.git', :tag => 'v3.0.3' }
s.source_files = "NCMB/**/*.{h,m,c}"
s.frameworks = "Foundation", "UIKit", "MobileCoreServices", "AudioToolbox", "SystemConfiguration"
s.requires_arc = true
Expand Down
2 changes: 1 addition & 1 deletion NCMB/NCMBConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#pragma mark - error
#define ERRORDOMAIN @"NCMBErrorDomain"
#define SDK_VERSION @"3.0.2"
#define SDK_VERSION @"3.0.3"

#define DATA_MAIN_PATH [NSHomeDirectory() stringByAppendingPathComponent:@"Library/"]
#define COMMAND_CACHE_FOLDER_PATH [NSString stringWithFormat:@"%@/Private Documents/NCMB/Command Cache/", DATA_MAIN_PATH]
Expand Down
2 changes: 1 addition & 1 deletion NCMB/NCMBError.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#import <Foundation/Foundation.h>

/*! @abstract ncmb error domain */
extern NSString const *kNCMBErrorDomain;
extern NSString * const kNCMBErrorDomain;

extern NSInteger const NCMBErrorFacebookLoginCancelled;

Expand Down
2 changes: 1 addition & 1 deletion NCMB/NCMBError.m
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#import "NCMBError.h"


NSString const *kNCMBErrorDomain = @"com.nifcloud.mbaas";
NSString * const kNCMBErrorDomain = @"com.nifcloud.mbaas";

NSInteger const NCMBErrorFacebookLoginCancelled = 401004;

Expand Down
3 changes: 0 additions & 3 deletions NCMB/NCMBPush.m
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,6 @@ + (void) handleRichPush:(NSDictionary *)userInfo {
UIInterfaceOrientation orientation = [[UIApplication sharedApplication]statusBarOrientation];
[rv appearWebView:orientation url:urlStr];
}
NSURL *url = [NSURL URLWithString:urlStr];
NSURLRequest *req = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:5];
[rv loadRequest:req];
}
}

Expand Down
5 changes: 5 additions & 0 deletions NCMB/NCMBRequest/NCMBRequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
header:(NSDictionary *)headers
body:(NSDictionary *)body;

-(instancetype)initWithURLStringForUser:(NSString *)urlString
method:(NSString *)method
header:(NSDictionary *)headers
body:(NSDictionary *)body;

-(instancetype)initWithURL:(NSURL *)url
method:(NSString *)method
header:(NSDictionary *)headers
Expand Down
19 changes: 19 additions & 0 deletions NCMB/NCMBRequest/NCMBRequest.m
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,25 @@ -(instancetype)initWithURLString:(NSString *)urlString
return [self initWithURL:url method:method header:headers bodyData:bodyData];
}

-(instancetype)initWithURLStringForUser:(NSString *)urlString
method:(NSString *)method
header:(NSDictionary *)headers
body:(NSDictionary *)body
{
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"%@/%@/%@",kEndPoint,kAPIVersion,urlString]];
NSData *bodyData = nil;
if (body != nil) {
NSError *error = nil;
bodyData = [NSJSONSerialization dataWithJSONObject:body
options:kNilOptions
error:&error];
if (error) {
[NSException raise:NSInvalidArgumentException format:@"body data is invalid json format."];
}
}
return [self initWithURL:url method:method header:headers bodyData:bodyData];
}

+(NSString *)returnTimeStamp{
return [[NCMBDateFormat getIso8601DateFormat] stringFromDate:[NSDate date]];
}
Expand Down
3 changes: 2 additions & 1 deletion NCMB/NCMBRichPush/NCMBRichPushView.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <Webkit/Webkit.h>

@interface NCMBRichPushView : UIWebView
@interface NCMBRichPushView : UIViewController

- (void) appearWebView:(UIInterfaceOrientation)interfaceOrientation url:(NSString*)richUrl;
- (void) sizingWebView:(UIInterfaceOrientation)interfaceOrientation;
Expand Down
33 changes: 14 additions & 19 deletions NCMB/NCMBRichPush/NCMBRichPushView.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@
#define CLOSE_BUTTON_BOTTOM_MARGIN 5.0
#define CLOSE_BUTTON_LEFT_MARGIN 20.0

@interface NCMBRichPushView() <UIWebViewDelegate, UIActionSheetDelegate>
@interface NCMBRichPushView() <WKNavigationDelegate>

@property (nonatomic) UIView *cv; //clear view
@property (nonatomic) UIView *uv; //ui view
@property (nonatomic) UIWebView *wv; // web view
@property (nonatomic) WKWebView *wv; // web view
@property (nonatomic) UIButton* closeButton;

@end
Expand Down Expand Up @@ -59,8 +59,7 @@ - (void)appearWebView:(UIInterfaceOrientation)interfaceOrientation url:(NSString


self.uv = [[UIView alloc]init];

self.wv = [[UIWebView alloc]init];
self.wv = [[WKWebView alloc]init];

//make instance of closeImageView
NCMBCloseImageView *closeImage = [[NCMBCloseImageView alloc]initWithFrame:CGRectMake(0, 5, CLOSE_BUTTON_WIDTH, CLOSE_IMAGE_FRAME_SIZE)];
Expand Down Expand Up @@ -121,10 +120,7 @@ - (void)appearWebView:(UIInterfaceOrientation)interfaceOrientation url:(NSString
self.uv.layer.cornerRadius = 5;
self.uv.clipsToBounds = YES;

//set webpage size to webview size
self.wv.scalesPageToFit = YES;

self.wv.delegate = self;
self.wv.navigationDelegate = self;

//add subview to main view
[window.rootViewController.view addSubview:self.cv];
Expand All @@ -135,10 +131,13 @@ - (void)appearWebView:(UIInterfaceOrientation)interfaceOrientation url:(NSString
self.uv.alpha = 1.0f;
}];

NSURL *url = [NSURL URLWithString:richUrl];
NSURLRequest *req = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:5];
[self.wv loadRequest:req];
}

-(void)loadRequest:(NSURLRequest *)request{
[self.wv loadRequest:request];
- (WKNavigation *)loadRequest:(NSURLRequest *)request{
return [self.wv loadRequest:request];
}

- (void)resizeWebViewWithNotification:(NSNotification *)notification {
Expand Down Expand Up @@ -237,29 +236,25 @@ -(void)endWebViewLoading{
[activity stopAnimating];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView{
- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation{
[self endWebViewLoading];
}

# pragma webview delegate

- (BOOL) webView:(UIWebView*) webView
shouldStartLoadWithRequest:(NSURLRequest*) request
navigationType:(UIWebViewNavigationType) navigationType
{
- (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler{
[self startWebViewLoading];

return YES;
decisionHandler(WKNavigationActionPolicyAllow);
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
- (void)webView:(WKWebView *)webView didFailNavigation:(WKNavigation *)navigation withError:(NSError *)error{
if ([error code] != NSURLErrorCancelled){
UIView* bg = [self.wv viewWithTag:ActivityIndicatorBackgroundTag];
[bg removeFromSuperview];

NSString *html = @"<html><body><h1>ページを開けません。</h1></body></html>";
NSData *bodyData = [html dataUsingEncoding:NSUTF8StringEncoding];
[self.wv loadData:bodyData MIMEType:@"text/html" textEncodingName:@"utf-8" baseURL:[[NSURL alloc]init]];
[self.wv loadData:bodyData MIMEType:@"text/html" characterEncodingName:@"utf-8" baseURL:[[NSURL alloc]init]];
}
}

Expand Down
27 changes: 13 additions & 14 deletions NCMB/NCMBUser.m
Original file line number Diff line number Diff line change
Expand Up @@ -664,14 +664,15 @@ +(NCMBRequest*)createConnectionForLogin:(NSString*)username
//pathの作成
NSString *path = @"";
for (int i = 0; i< [sortedQueryArray count]; i++){
NSString * query = [sortedQueryArray[i] stringByAddingPercentEncodingWithAllowedCharacters:[[NSCharacterSet characterSetWithCharactersInString:@"#[]@!&()*+,;\"<>\\%^`{|} \b\t\n\a\r"] invertedSet]];
if (i == 0){
path = [path stringByAppendingString:[NSString stringWithFormat:@"%@", sortedQueryArray[i]]];
path = [path stringByAppendingString:[NSString stringWithFormat:@"%@", query]];
} else {
path = [path stringByAppendingString:[NSString stringWithFormat:@"&%@", sortedQueryArray[i]]];
path = [path stringByAppendingString:[NSString stringWithFormat:@"&%@", query]];
}
}
NSString *url = [NSString stringWithFormat:@"login?%@", path];
NCMBRequest *request = [[NCMBRequest alloc] initWithURLString:url
NCMBRequest *request = [[NCMBRequest alloc] initWithURLStringForUser:url
method:@"GET"
header:nil
body:nil];
Expand Down Expand Up @@ -799,9 +800,7 @@ + (void)logOutInBackgroundWithBlock:(NCMBErrorResultBlock)block{
NCMBURLSession *session = [[NCMBURLSession alloc] initWithRequestAsync:request];
[session dataAsyncConnectionWithBlock:^(NSDictionary *responseData, NSError *requestError){
if (!requestError){
if (!requestError) {
[self logOutEvent];
}
[self logOutEvent];
}
if(block){
block(requestError);
Expand Down Expand Up @@ -930,12 +929,14 @@ - (NSMutableDictionary *)toJSONObjectForDataFile{
ローカルオブジェクトをリセットし、ログアウトする
*/
- (void)afterDelete{
[super afterDelete];
if ([NCMBUser currentUser]!= nil && [NCMBUser.currentUser.objectId isEqualToString:self.objectId]) {
[NCMBUser logOutEvent];
}
self.userName = nil;
self.password = nil;
self.sessionToken = nil;
self.mailAddress = nil;
[NCMBUser logOutEvent];
[super afterDelete];
}

- (void)afterFetch:(NSMutableDictionary *)response isRefresh:(BOOL)isRefresh{
Expand All @@ -958,11 +959,7 @@ - (void)afterFetch:(NSMutableDictionary *)response isRefresh:(BOOL)isRefresh{
*/
-(void)afterSave:(NSDictionary*)response operations:(NSMutableDictionary *)operations{
[super afterSave:response operations:operations];
BOOL isHasTokenKey = NO;
if ([response objectForKey:@"sessionToken"]){
[self setSessionToken:[response objectForKey:@"sessionToken"]];
isHasTokenKey = YES;
}

//会員新規登録の有無
//if ([response objectForKey:@"createDate"]&&![response objectForKey:@"updateDate"]){
if ([response objectForKey:@"createDate"] && [response objectForKey:@"updateDate"]){
Expand Down Expand Up @@ -991,9 +988,11 @@ -(void)afterSave:(NSDictionary*)response operations:(NSMutableDictionary *)opera
}
[estimatedData setObject:converted forKey:@"authData"];
}
[NCMBUser saveToFileCurrentUser:self];
}

if([self isEqual:[NCMBUser currentUser]] || isHasTokenKey){
if ([self.objectId isEqualToString:[NCMBUser currentUser].objectId]) {
self.sessionToken = [NCMBUser currentUser].sessionToken;
[NCMBUser saveToFileCurrentUser:self];
}
}
Expand Down
2 changes: 1 addition & 1 deletion NCMB/NCMB_Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>3.0.2</string>
<string>3.0.3</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
Expand Down
2 changes: 1 addition & 1 deletion NCMBTests/NCMBTests/NCMBInstallationSpec.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ -(NSMutableDictionary *)beforeConnection;
},
@"applicationName" : @"aaaa",
@"objectId" : @"EVMu2ne7bjzZhOW2",
@"sdkVersion" : @"3.0.2"
@"sdkVersion" : @"3.0.3"
};

NSDictionary *responseInstallation = @{@"channels" : @[
Expand Down
Loading

0 comments on commit 6afaa55

Please sign in to comment.