Skip to content

Commit

Permalink
[Cloud]iOS support
Browse files Browse the repository at this point in the history
  • Loading branch information
OFFTKP committed Dec 17, 2023
1 parent 14af909 commit 5ae613e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
5 changes: 0 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@ set(SOKOL_HEADERS
if(ANDROID)
add_definitions(-DSE_PLATFORM_ANDROID)
set(LINK_LIBS ${LINK_LIBS} GLESv3 EGL OpenSLES log android)
# link_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/curl-mobile/android/${ANDROID_ABI})
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/curl-mobile/android/include)
message("Android Build!")
endif()
if(MACOS OR IOS)
Expand Down Expand Up @@ -299,9 +297,6 @@ endif()
if(IOS)
set(SKYEMU_SRC ${SKYEMU_SRC} src/ios_support.m)
add_definitions(-DSE_PLATFORM_IOS)
# set(LINK_LIBS ${LINK_LIBS} curl z)
# link_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/curl-mobile/iOS)
# include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src/curl-mobile/iOS/include)
endif()

if(WIN32)
Expand Down
4 changes: 3 additions & 1 deletion src/cloud.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ void cloud_drive_authenticate(cloud_drive_t* drive)
{
#ifdef EMSCRIPTEN
return em_oath_sign_in(drive, GOOGLE_CLIENT_ID_WEB);
#elif !defined(SE_PLATFORM_IOS)
#else
srand(time(NULL));
const char* charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
std::string code_verifier;
Expand Down Expand Up @@ -691,6 +691,8 @@ void cloud_drive_authenticate(cloud_drive_t* drive)
pJNIEnv->CallVoidMethod(nativeActivity, MethodOpenURL, jstrURL);
pJavaVM->DetachCurrentThread();
}
#elif SE_PLATFORM_IOS
se_ios_open_url(request.c_str());
#else
printf("Navigate to the following URL to authorize the application:\n%s\n", request.c_str());
#endif
Expand Down
1 change: 1 addition & 0 deletions src/ios_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
void se_ios_open_file_picker( int num_extensions, const char ** extensions);
void se_ios_get_safe_ui_padding(float *top, float* bottom,float* left, float *right);
void se_ios_set_documents_working_directory();
void se_ios_open_url(const char * url);
#endif
5 changes: 5 additions & 0 deletions src/ios_support.m
Original file line number Diff line number Diff line change
Expand Up @@ -116,3 +116,8 @@ void se_ios_get_safe_ui_padding(float *top, float* bottom,float* left, float *ri
if(right)*right = window.safeAreaInsets.right;
}
}
void se_ios_open_url(const char * url){
NSString* urlString = [NSString stringWithUTF8String:url];
NSURL* nsurl = [NSURL URLWithString:urlString];
[[UIApplication sharedApplication] openURL:nsurl options:@{} completionHandler:nil];
}

0 comments on commit 5ae613e

Please sign in to comment.